In Sql Management Studio (2012) I have set up a linked Oracle server which works fine. However, I cannot see or access any tables that are in the default schema (i.e., which do not have a schema name).
In other words I can do this:
SELECT * FROM (LinkName)..(SchemaName).(TableName)
but I can't do this:
SELECT * FROM (LinkName)...(TableName)
These tables also do not show up under the Linked Server tables folder, and doing a select returns the error "The table either does not exist or the current user does not have permissions on that table."
I know the tables are there and I have the appropriate rights because I can see and access these tables when working with SSIS on the same machine, and with the same credentials.
Any ideas?
Related
I have installed Oracle Database 11g Release 2 (11.2.0.1.0) for Microsoft Windows (x64). How do I create a new schema or local schema?
A schema is the collection of objects owned by a user.
So connect as a power user like SYSTEM and run a create user command. Find out more.
Once you have a user you can connect to it and create tables and other objects.
Have you tried looking in the docs? https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_6014.htm#SQLRF01313
In oracle a 'schema' is nothing more than the collection of objects belonging to a given user. Many people will even argue that a "user" is a "schema". I believe that it was with 11g (now out of support) that oracle introduced the CREATE SCHEMA command. That command simply combines creating a user and creating some tables belonging to that user into a single SQL statement. You can always do it the "old fashioned" way by simply issuing a CREATE USER, then issuing whatever CREATE . statements you need:
create user fubar identified by fubar;
create table fubar.mytable (dob date);
create view fubar.myview as (select * from fubar.mytable);
etc. etc.
I am a developer for a hospital which uses software provided by a 3rd party vendor which hosts Sql Server for us. We have a local instance of Sql Server 2012 which has a linked server to their Sql Server instance. Within our instance of Sql Server we can see all of the Views and Tables that have been assigned to us but none of the stored procedures.
However, I have been given a Citrix connection which allows me to access Sql Server on their network. From here, I can create, alter and execute stored procedures in the [CUSTOMER] schema they created for this purposes (we can only execute procs in dbo, but not alter or create).
The vendor is now trying to give me access to execute stored procedures we created in [CUSTOMER] through our linked server. However, it's not working. They say they have given permission to my user as well as the user listed under the Security tab of Linked Server Properties in "Be made using this security context".
Properties for RPC and RPC Out are set to true.
No Sp's show up under the linked server node (no "programmability" node at all). And when I try to execute my proc like this: [remoteserver.ip.address].[remoteDbInstance].[Customer].[extr_myProc], I get the following error:
"Cannot find the object "extr_myProc" because it does not exist or you do not have permissions."
I suspect there's an issue on their side but our contact at the vendor says they've done everything. Is there something else I should be doing on my side though?
I suspect that there's more than one measure a vendor can take to lock down stored procs over a linked server and all their support staff did was to make sure [CUSTOMER] was executable for our users, but another setting is blocking it specifically for linked servers.
Is there something I can suggest to their support staff to look at for us that can hide stored procs from a user, but only over a linked server?
Thanks!
I have two SQL Server catalogs. One of the SQL Server catalogs is showing tables only from master on execution of following commands whereas the other SQL Server catalog displays all the user defined tables.
Why the two catalog is behaving differently?
select * from ib.sys.tables;
show tables from ib.dbo;
There is difference in configuration (user + default instance) of presto sql server connector.
user used to create catalog have different set of permission /default schema and default data base .
I have two databases. lets name them A and B. The database B is in different IP with different username and password. But I want to create a view in Database A linking to a table in Database B. How can I achieve this because of database B authentication.
You should create a linked Server in your Server in which DatabaseA exists.
You can google how to create Linked Server in SQL Server
EXEC sp_addlinkedserver
#server='ServerNameOfDatabaseB',
#srvproduct='',
#provider='SQLNCLI',
#datasrc='NCSUSPRODSQL02'
Once you create linked server then your view code would be something like the below.
CREATE VIEW Viewname
AS
SELECT *
FROM LinkedServerName.DatabaseB.SchemaName.TableName
I am a bit confused as to how the default database schema is determined in MS SQL server.
I have the following stored procedure as a minimal working example:
CREATE PROCEDURE [dbo].[SampleSP]
AS
SELECT 'HI' as [SampleColumn]
INTO [SampleTable]
DROP TABLE [SampleTable]
All tests are executed using a user User on MS SQL server using Windows Auth with a default database schema of the same name.
When I execute this SP on MS SQL Server 2005 installation (running in compatibility mode 80, i.e. Server 2000) the table is created as [User].[SampleTable] and DROP TABLE fails with Invalid object name 'SampleTable' (I assume because it looks for [dbo].[SampleTable])
When I DROP TABLE [SampleTable] in a separate query it does work
When I execute the SP on MS SQL Server 2008 R2 (also running in compat. 80) the table is created as [dbo].[SampleTable] and dropped without error
I have found this answer describing the lookup in stored procedures, but it doesn't mention the user default in that context, even though it is used on 2005. Maybe someone knows how this changed and whether new versions can be configured to behave the same way.
It sounds like you just need to set the default schema for the user to dbo:
ALTER USER YourUser WITH DEFAULT_SCHEMA = dbo;
That way it's set at the user level and you won't need to alter any code.