I have created Global Temporary table in oracle and inserting the data through my application, and its working fine for me when i connect to database with "system" as the username. Where as i have created one more user in the database with "user1" and have given "Grant all" privileges to this user also. Now when am connecting to database with "User1" as the username and running the application, the data is not inserting into Global temporary table.
But when i try to insert data from sql developer tool its inserting.
With system user through application also working, whereas with user1 its not inserting. Am not getting whats behind going as am not that much DB expert.
Please have any idea suggest me. I have all privileges also. Thanks in advance.
Fist, the table MUST be in other schema than SYS or SYSTEM. Create it on "User1".
Second, you must be sure that you select from the same table. Prefix the table with the schema when inserting and also when reading.
Also be sure that you are not in the situation of table created with ON COMMIT DELETE ROWS and some AUTOCOMMIT ON in Sql Developer.
Related
I'm not a DB expert, my boss has retired and it's up to me now. He created a production database, and a test database on another server with same username/password and schema name test_SameAsOtherDB. I'm trying to pull the live data from the production table, into the test DB table, but there are no privileges for me to do so.
I tried by logging into my production DB and "grant select on mytable_name to testDB.mytable_name;" but it gives me the error "ORA-00933: SQL command not properly ended".
I've tried all the combinations of user/password/schema that I could think of, but none work.
Everything I've researched says use "GRANT select on tablename to USER" but the user is the same on each DB.
Hope I made sense, any help would be appreciated.
Thanks,
John
You access a database on another server through a DATABASE LINK, not with the syntax to access an object in another schema on the same server.
You must create the DBLINK using the "CONNECT TO user IDENTIFIED BY password" syntax. (And the user used to execute "CREATE DATABASE LINK" must have the privilege to do...)
Then you will be able to "SELECT ... FROM mytable_name#DBLINK_TESTDB" assuming you named the DBLINK "DBLINK_TESTDB" with the same rights the user used in the "CONNECT TO" statement has in the target DB.
(And change that policy having the same passwords in all environment...)
I am working in an Oracle APEX application and am trying to query tables in another schema (that another Oracle APEX application sits on) to pull in data to my application.
The applications are hosted within the same APEX workspace and on the same Oracle 11g instance. Our application have tables that are structurally the same as the tables we're trying to query in the other schema.
Using the schema prefix (SELECT * FROM "SCHEMA2".TABLE1;) when querying is throwing an error that the tables do not exist (ORA-00942: table or view does not exist)
The second thing I tried is creating a database link between the two schemas, but when trying to establish the connection I'm getting the following error: ORA-01031: insufficient privileges
Can someone identify where I'm going wrong here / help me figure out how to query the other schema?
Database link is used when there are different databases involved; your schemas reside in the same database which means that the first attempt was correct: prefixing table name with its owner, e.g.
SELECT * FROM SCHEMA2.TABLE1
However, first connect as schema2 user and issue
grant select on table1 to schema1;
Otherwise, schema1 can't see the table. If schema1 is supposed to do something else with that table, you'll have to grant additional privileges, such as insert, update, delete, ....
I have created an Oracle DB.
With the user SYSTEM I created a tablespace and another user with CONNET and DBA roles, associated with this tablespace, called PP. Then with this user I have created some tables.
Well, when i do a connection to the database with the user PP in SQL Developer it shows me only the tables that I create with this user. Thats ok.
The problems comes when I do a connection with other application, using aswell the same user PP. It show me the tables I've created, and some more, rather a lot of them.
Examples:
ALL$AW_CUBE_ENABLED_HIERCOMBO
APEX_APPLICATION_PAGE_IR_COMP
REPCAT$_RESOL_STATS_CONTROL
SCHEDULER_JOB_ARGS_TBL
WWV_FLOW_AUTHORIZED_URLS
....
I suppose this tables are from system or sys user.
Why can I see them with my user PP?
How can I do to hide them?
Thanks a lot.
I want to create the user and the database within that user. But when I tried to create database its giving the warning message as
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-01100: database already mounted
Then I tried
STARTUP NOMOUNT;
Its giving the warning message for insufficient privileges even I have given all the permission to that particular user.
Can any one please help in finding the solution for this?
You don't create a database under a user in Oracle; I believe you're using terminology from another database poduct. The equivalent is a schema, which is a logical container for a group of objects. User and schema are essenentially synonymous in Oracle - when you create a user is automatically has its own schema.
You create the database once (which you already seem to have done, or had done for you), then create as many schemas/users as your application needs. You don't ever rerun the create database under normal circumstances - you certainly wouldn't as a normal user.
If you connect as that user you will be able to create tables, views, packages etc., assuming it has really been granted all the necessary privileges.
I'm not a DBA, but I have some basic understanding about how SQL Server is supposed to work. I'm having trouble translating this knowledge into getting a working Oracle XE database, so my girlfriend can play around with her bookstore coursework.
So, I installed Oracle XE database, and downloaded Oracle SQL Developer. I supplied a password, during installation, and using this password in conjunction with sys login in sysdba-mode, I'm able to connect and browse the database, which I can only assume is the master database, since there are numerous tables that have nothing to do with future bookstores.
I want to create a new - empty database, and I don't much care about how it's configured. It's a playpen for coursework. So I happily stab with:
create database bookstore
and recieve an error to the effect of:
ORA-01100: database already mounted
I just want to create a new database, so that if something goes wrong i can do a drop database bookstore instead of manually deleting tables and such. In SQL Server Management Studio you execute these statements on the master database, and then connect to the specific database you want to play with.
A SQL Server database is roughly equivalent to a schema in Oracle. And a schema in Oracle is a collection of objects owned by a particular user.
Given that, it appears that you want to do something like
Create a user
CREATE USER bookstore IDENTIFIED BY bookstore;
Grant privileges to the user
GRANT CREATE SESSION TO bookstore;
GRANT UNLIMITED TABLESPACE TO bookstore;
GRANT CREATE TABLE TO bookstore;
GRANT CREATE VIEW TO bookstore;
GRANT CREATE TYPE TO bookstore;
GRANT CREATE SYNONYM TO bookstore;
GRANT CREATE PROCEDURE TO bookstore;
GRANT CREATE SEQUENCE TO bookstore;
GRANT CREATE MATERIALIZED VIEW TO bookstore;
Now, you should be able to connect to the bookstore schema in the XE database and create whatever tables, views, triggers, etc. you want.
You just need to create a schema in the database you already have. A schema in Oracle is sort of roughly equivalent to database in SQL Server, in some ways. Your girlfriend would use that schema as her playpen and you could drop it and recreate it easily. You should also create a user for her, which I think automatically creates a schema with same name as the user. But I would still create a dedicated coursework schema.
Oracle has extensive online documentation. Here's the master index for 10g. It's a bit daunting but you'll get to know your way around it.