3

I have an existing Linked Server with a few catalogs... how can I add another, existing database/catalog to this linked server?

For Example, my object explorer looks like this:

Linked Servers

  • Providers
  • DB4\PRODUCTION
  • DB4_LINK
    • Catalogs
      • System Catalogs
      • MyDatabase
      • MyOtherDatabase

How can I add yet another database that already exists to DB4_LINK?

EDIT: I'm trying to add an existing database to this linked server entry.

4

2 回答 2

5

Assuming there are existing Catalogs (databases) already being shown (which is the case in your question), the most likely thing that is preventing another database on that same linked server from appearing is Permissions.

Right-click on the server-to-link-to and do "Script Linked Server as" then CREATE to New Query Window... look at the sp_addlinkedsrvlogin call and note the rmtuser (remote user). This is the user that you needs access to the database that you want to appear in the Catalogs.

Go to the server-to-link-to (under Security / Logins) and adjust that login's permissions (via Properties) to include the missing db. (Check the perms that the login has to the dbs that do appear in the Catalog... you can use those specific perms as a reference)

于 2016-10-25T15:33:53.160 回答
4

You can do this by sending dynamic SQL via the linked server:

EXEC DB4_LINK.master..sp_executesql N'CREATE DATABASE foo;';

Of course this requires that you have the permissions to do so, and it's a simplistic command assuming that the default settings are fine - you may want to customize the CREATE DATABASE command.

于 2012-08-15T18:49:00.743 回答