I'm logged in as sysdba and I'd like to know which schema I'm using
If I create a table as sysdba how to see in which schema was created.
To return the current schema use:
SELECT SYS_CONTEXT('userenv', 'current_schema') FROM dual;
Related
I want to convert the SQL script from SQL Server to MariaDB of the following below but I can't figure out.
IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'client')
CREATE USER `client` FOR LOGIN `client` WITH DEFAULT_SCHEMA=`dbo`;'
ALTER ROLE `db_client` ADD MEMBER `client`
ALTER AUTHORIZATION
ON [ <class_type>:: ] entity_name
TO { principal_name | SCHEMA OWNER }
[;]
What is the best way to migrate SQL Server to MariaDB?
Or any equivalent of MariaDB?
I am a beginner to ireports.I want to create an ireport with oracle 11g using the default tables present in xe. I used EMP table from xe and it showed error ORA-00942 table or view does not exist when i run the query select * from EMP.
Please help!!!
Generally speaking, you should connect to user that contains tables you'd like to use in the report you're creating. So, if it is EMP table and it belongs to Scott, connect as Scott.
By default, its username/password combination is scott/tiger (all lower case). There's a chance that it (user) is locked. If so, connect to the database via SQL*Plus or SQL Developer or any other tool you use (as a privileged user, such as SYS or SYSTEM if there's no other you have - I presume you don't) and do the following:
alter user scott account unlock;
alter user scott identified by tiger;
After that, establish connection to Scott in iReport (providing previously mentioned credentials) and you should be able to query the EMP table.
I am new to oracle. I have created the user axsaum in DB and logged in as the same user. When I try to access
select * from user_tables or dba_tables
its throwing error as table not exist
Please suggest me why i dont have privilege to access default tables?
how to access those?
SQL> select * from user_tables;
* ERROR at line 1: ORA-00942: table or view does not exist
SQL> select * from dba_tables;
* ERROR at line 1: ORA-00942: table or view does not exist
I think you need to give previliages to newly created user
you can use grant for giving permission to user
once permission given you can see tables as well as can perfrom DML and DDL on DB
for gratting previliages
for all permissions you can use
GRANT DBA TO axsaum ;
For other permissions you use below
GRANT CONNECT TO axsaum ;
GRANT SELECT ANY TABLE to axsaum
is a system privilege grant that allows user to select from any Table or View.
GRANT SELECT on some_table to axsaum
is an object privilege grant that allows user to select from Table.
GRANT SELECT, UPDATE ON some_table TO axsaum;
I do MSSQL administration and recently got involved with Oracle. So my Oracle admin skills obviously is weak. I have a question regarding Oracle account and permissions. Say I have the following two schemas (users) created on an Oracle 12c instance – John and Dave. How do I grant “John” SELECT privilege to all the tables under the “Dave” schema? If possible, can you list the steps or better yet, the SQL commands.
Thank you
FOR x IN (SELECT table_name FROM all_tables where owner='DAVE')
LOOP
EXECUTE IMMEDIATE 'GRANT SELECT ON ' || x.table_name || ' TO JOHN';
END LOOP;
How can I specify a schema name in SQL ConnectionString using ASP.net dynamically.
I have a single database with multiple schema. I need to fetch data from table belonging to particular schema.
You can only specify the database and user details in the connection string.
To retrieve data from a specific schema, you need to reference that schema in your query. For example;
SELECT field1, field2 FROM [Schema].[Table]
I would like to reference here an older thread, which is definitely useful in this question:
Possible to set default schema from connection string?
You can only set the default schema to the user itself.
You can try an ALTER USER statement, where you can define a default schema to the user.
It means you can create a user to each schema, if that is what you need.
Each user has their own schema and that is the default schema. Once logged in you can execute:
ALTER SESSION SET CURRENT_SCHEMA = myschema
So you need to execute an extra statement after connecting.