I wrote the following commands:
create directory orcl_full as '/oradata3/datapump/full_export';
create user user1 identified by admin12;
grant read,write on directory orcl_full to user1;
grant exp_full_database to user1;
But when I tried exporting data using expdp command, it did not work:
expdp user1#ri/admin12#ORCL directory=orcl_full dumpfile=orclfull.dmp logfile=full_export.log FULL=YES;
Here is the error I get:
ORA-31626: job does not exist
ORA-31633: unable to create master table "user1.SYS_EXPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 1048
ORA-01950: no privileges on tablespace 'USERS'
I am stuck here, can someone kindly help me. In the tutorials, this command was working.
ORA-31626: job does not exist
ORA-31633: unable to create master table
Datapump uses a master table to manage the export job. Like any other table it needs storage which means it needs to write to a tablespace.
ORA-01950: no privileges on tablespace 'USERS'
When you created user1 account you did not grant it any tablespace privileges. So it cannot create any tables and that's why the job fails. The solution is quite simple: grant quota on the USERS tablespace (the default tablespace if no other is specified for the user account).
alter user user1 quota unlimited on users;
"got the following error :SP2-0734: unknown command beginning "expdp use..." - rest of line ignored. "
expdp is an OS executable. Your error is a SQL*plus error, which is a SQL client. Either fire up a terminal window and run the OS command there, or shell out from SQL*Plus using the host command.
This command worked :
expdp user1#ri15/$d_pass directory=orcl_full dumpfile=orclfull.dmp logfile=full_export.log FULL=YES;`
Related
we are starting to work with oracle multitenant architecture, and modify our custom shell commands accordingly. so in the aspect of running an SQLPlus query against the CDB, nothing has really much changed, we are still declaring the Oracle_HOME and Oracle_SID environment variables, and concatenating the actual query and the user and password credentials, like this:
export ORACLE_SID=contdev;export ORACLE_HOME=/oracle/app/oracle/product/19.3;printf "SHOW CON_NAME;"| $ORACLE_HOME/bin/sqlplus -s 'c##devuser/devpassword'
but we are struggling to achieve the same for the PDB, as we don't use tnsnames, we still required to connect with user name and password, with a one liner shell command, not a script. due to our security team policy.
searching on web, we have found that another environment variable is available for the PDB, named: ORACLE_PDB_SID. but when we trying to ran the following command:
export ORACLE_SID=contdev;ORACLE_PDB_SID=contDev1;export ORACLE_HOME=/oracle/app/oracle/product/19.3;printf "SHOW CON_NAME;"| $ORACLE_HOME/bin/sqlplus -s 'c##devuser/devpassword'
We are still getting the output from the root container, and not the PDB:
CON_NAME
------------------------------
CDB$ROOT
Another search on the web, we found that we need use ALTER SESSION SET CONTAINER=contDev1; but it's not clear how to use this, in the above command.
After connecting to the Oracle database, just type show pdbs:
SQL> show pdbs
SQL> alter session set container=<DB_NAME>_PDB;
SQL> show pdbs
I am running a script with SQLPlus in an Oracle DB which creates extra tablespaces. Here is the code of the script:
CREATE TABLESPACE FAR_YELLOW_FISH
DATAFILE
'$ORADATA/node03/faryellowfish01.dbf' SIZE 200M,
'$ORADATA/node03/faryellowfish02.dbf' SIZE 200M;
CREATE TABLESPACE WET_BROWN_SOUP
DATAFILE
'$ORADATA/node01/wetbrownsoup01.dbf' SIZE 100M,
'$ORADATA/node03/wetbrownsoup02.dbf' SIZE 100M;
CREATE TABLESPACE EASY_ORANGE_DISK
DATAFILE
'$ORADATA/node03/easyorangedisk01.dbf' SIZE 100M,
'$ORADATA/node03/easyorangedisk02.dbf' SIZE 100M,
'$ORADATA/node02/easyorangedisk03.dbf' SIZE 100M,
'$ORADATA/node02/easyorangedisk04.dbf' SIZE 100M;
CREATE TABLESPACE WET_YELLOW_OVEN
DATAFILE
'$ORADATA/node01/wetyellowoven01.dbf' SIZE 100M;
Before this I run the following:
sqlplus /nolog
connect / as sysdba
create SPFILE from PFILE;
startup nomount
and a script which creates main tablespaces - it works properly.
When running the script, that I mentioned first, I get the following error: ORA-01109: database not open. It appears for each CREATE TABLESPACE expression.
As a solution I tried to run ALTER DATABASE OPEN; but the answer was ORA-01507: database not mounted.
I guess, there is something wrong with the script, but not sure about that.
How can I solve it?
Your startup script isn't starting the database.
To start the database, do this:
sqlplus /nolog
connect / as sysdba
startup
Also, do not use environment variables (i.e. $ORADATA) in your SQL script. sqlplus won't know what they mean. Include the full path.
I am trying to install the sales_history sample schema, but I'm getting errors:
SP2-0310: unable to open file "__SUB__CWD__/sales_history/csh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/lsh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/psh_v3.sql"
How can I resolve this issue? The csh_v3.sql has full permissions,
Full session output:
SQL> #?/demo/schema/sales_history/sh_main.sql
specify password for SH as parameter 1:
Enter value for 1: password
specify default tablespace for SH as parameter 2:
Enter value for 2: users
specify temporary tablespace for SH as parameter 3:
Enter value for 3: temp
specify password for SYS as parameter 4:
Enter value for 4: password
specify directory path for the data files as parameter 5:
Enter value for 5: /u01/app/oracle/product/12.2/db_1/demo/schema/sales_history/
writeable directory path for the log files as parameter 6:
Enter value for 6: /u01/app/oracle/product/12.2/db_1/demo/schema/log/
specify version as parameter 7:
Enter value for 7: v3
specify connect string as parameter 8:
Enter value for 8: localhost:1522/techfuturepdb.elom.tg
Session altered.
DROP USER sh CASCADE
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
old 1: CREATE USER sh IDENTIFIED BY &pass
new 1: CREATE USER sh IDENTIFIED BY password
CREATE USER sh IDENTIFIED BY password
*
ERROR at line 1:
ORA-01920: user name 'SH' conflicts with another user or role name
old 1: ALTER USER sh DEFAULT TABLESPACE &tbs
new 1: ALTER USER sh DEFAULT TABLESPACE users
old 2: QUOTA UNLIMITED ON &tbs
new 2: QUOTA UNLIMITED ON users
User altered.
old 1: ALTER USER sh TEMPORARY TABLESPACE &ttbs
new 1: ALTER USER sh TEMPORARY TABLESPACE temp
User altered.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Grant succeeded.
old 1: CREATE OR REPLACE DIRECTORY data_file_dir AS '&data_dir'
new 1: CREATE OR REPLACE DIRECTORY data_file_dir AS '/u01/app/oracle/product/12.2/db_1/demo/schema/sales_history/'
Directory created.
old 1: CREATE OR REPLACE DIRECTORY log_file_dir AS '&log_dir'
new 1: CREATE OR REPLACE DIRECTORY log_file_dir AS '/u01/app/oracle/product/12.2/db_1/demo/schema/log/'
Directory created.
Grant succeeded.
Grant succeeded.
Grant succeeded.
Connected.
Session altered.
Session altered.
SP2-0310: unable to open file "__SUB__CWD__/sales_history/csh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/lsh_v3.sql"
SP2-0310: unable to open file "__SUB__CWD__/sales_history/psh_v3.sql"
I just renamed the directory and it worked as expected:
mv db-sample-schemas-19.2 "__SUB__CWD__" ;
sqlplus system/Welcome1#node3/pdb1 #"__SUB__CWD__"/mksample.sql
I want to create a database in MySQL using command line. so I use shell option in xampp to create it.
I write this line
create database abc;
access denied for user #'localhost' to database abc;
I am trying to create database using Oracle 11g R2 on windows 2008 server, when I run script to create database instance I will get the following error message
ERROR at line 1:
ORA-01109: database not open
grant select on ALL_MVIEW_DETAIL_PARTITION to public with grant option
*
ERROR at line 1:
ORA-01109: database not open
logged on as administrator.`
Thanks,
usermma
Login to Oracle with root
su - oracle
sqlplus / as sysdba
create user username identified by password;
Exception : ORA-01109 Database not open
To resolve this i trie below steps and succesfully created the schema.
Please verify the ORA_HOMEPATH/dbs/sgadef.dbf
Make ensure that after shutting down the Oracle server,if you find any services running on machine by entering below command
ps -ef | grep ora_ | grep DBName(sid)
Kill the processes if you find any by using kill command
kill -9 PID
Please check below file exists in mentioned path; if not please create.
ORACLE_HOMEPATH/dbs/lk<sid>
start mount; If the server is started use close immediate
SQL> alter database close;
Database altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down
SQL> startup mount
ORACLE instance started.
Total System Global Area 126951228 bytes
Fixed Size 454460 bytes
Variable Size 109051904 bytes
Database Buffers 16777216 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> select open_mode from v$database;
OPEN_MODE
----------
MOUNTED
SQL> alter database open;
Database altered.
Now you can create your own schema as the database is open
SQL> create user schemaname identified by password;
SQL> grant resource,connect to schema name;
grant permission succeded.
I have done above steps to create a schema when database is not open.
Execute below Commands Sequentially....
> sqlplus
username/password = sys/*******
SQL> shutdown immediate;
SQL> startup mount;
SQL> recover database;
SQL> alter database open;
How did you create the script(s)? What does it do? Is there some reason you're not using the Database Configuration Assistant to do this? It may be simply a matter of not having the service for the instance created via oradim.