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.
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 want to connect to multiple (30) oracle databases which resides in different servers (27) via shell script and fetch details from each database. I have a user (test) created on all databases but the details I want to fetch needs sysdba privileges. In my environment, I cannot provide DBA privs to any other user due to limitations. Hence my idea is to connect to each database using sqlplus -s "$user/$password#$tnsentry" and then connect as sysdba to fetch details.
Though I am able to connect to all databases using test, the "connect as sysdba" is getting executed on current database in current server.
My script:
cat tmp/db.par | while read LINE
do
if [ -n "$LINE" ] ; then
tns_entry=$LINE
export tns_entry
sqlplus -s /nolog >> $tmp/query.log <
exit
sqlconn
fi
done
In the tns_entry loop, I have given ABC,DEF,GHI,JKL,MNO databases to get details from and I am running this query from a server where database XYZ resides. I didn't give XYZ in my loop and didn't connect to database but the query results are from XYZ database. Please help me on this.
Thank you!
You should connect as sysdba
add "as sysdba" in the script and try.
conn sys/password#tnsentry as sysdba
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;`
I want to connect user sys in sqlplus of oracle but after I connect, I type like this:
sqlplus sys as sysdba
password:123456
Error:
ORA-01030:insufficient privilege
warning:You are no longer to connect oracle.
Does anyone help me to solve my problem?
Your example looks a little garbled; to connect to sqlplus via the command line, with a user sys and password 123456:
sqlplus sys/123456 as sysdba
or
sqlplus "sys/123456 as sysdba"
prior to Oracle 10. If you are already inside sqlplus (as I assume from the fact that your example starts with a SQL>), you use the connect command:
SQL> connect sys/123456 as sysdba
In all cases, if you haven't set the environment variable ORACLE_SID, you need to specify that after the password, like this:
sqlplus sys/123456#<mydbname> as sysdba
where <mydbname> is either of the form <hostname>/<sid>, if you're using Oracle 10 or later, or a valid entry from your tnsnames.ora file (located in $ORACLE_HOME/network/admin) for all versions.
Is your operating system user account that you are logged in as a member of the ORA_DBA group (windows) or the DBA group (*nix)?
If the answer is yes, then the next thing to check is for the existence of the ORACLE_HOME\database\orapwORCL.ora file, which contains the passwords for all of the users defined as sysdba users. If it does not exist, you need to shutdown the database and execute the orapwd utility:
cd ORACLE_HOME\database
orapwd file=orapwORCL.ora password=123456 entries=10
This defines the sys password as 123456. You should then be able to start up the database and connect sys/123456 as sysdba
The password file must exist for password=based authentication on sysdba logins. The reason for this is the fact that sysdba connections must be allowed when the database is not up and the database cannot authenticate you.