Friday, December 7, 2018

Quick Reference for Oracle Database

Hiya Buddies,
We would like to share here a Quick Reference for Oracle Database related which may useful either in Project or Interviews...

Whenever we feel that topic or command is useful for future which may need handy, we would like to update here, so we can use anytime easily...

Please if you have also any such stuff, let us know either in comment box or contact us form. So, we can mentioned here and help everyone.

Oracle Database Startup Phases...

Nomount -- oracle opens and read init.ora file, start the background process.
Mount -- open and read control file for data files locations etc...
Open --  it accesses all of the data files associated with the database

Opening the Database in Restricted Mode

It will only allow users with special privileges to access the database like System administrator or DBAs, even though the database is technically open.

SQL> startup restrict

===========

Database start in RAC:
srvctl start database -d DB_NAME

##### To start instance in mount state #####

srvctl start instance -d <DB_NAME> -i <INSTANCE_NAME> -o mount
srvctl start instance -d <DB_NAME> -i <INSTANCE_NAME>

###### To mount database #####
srvctl start database -d <INSTANCE_NAME> -o mount

Command to Check Status:
srvctl status database -d DB_NAME

Command to Stop database Instance:
srvctl stop database -d <DB_NAME> -o immediate

===========


How to check datafiles Path or locations:

SQL> SELECT NAME FROM V$DATAFILE;
NAME
-------------------------------------------------------------------------------------
/home/oracle/app/oracle/oradata/orcl/system01.dbf
/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
/home/oracle/app/oracle/oradata/orcl/users01.dbf
/home/oracle/app/oracle/oradata/orcl/example01.dbf
/home/oracle/app/oracle/oradata/orcl/APEX_1930613455248703.dbf
/home/oracle/app/oracle/oradata/orcl/example02.dbf

7 rows selected.

SQL>
SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------
/home/oracle/app/oracle/oradata/orcl/users01.dbf
/home/oracle/app/oracle/oradata/orcl/undotbs01.dbf
/home/oracle/app/oracle/oradata/orcl/sysaux01.dbf
/home/oracle/app/oracle/oradata/orcl/system01.dbf
/home/oracle/app/oracle/oradata/orcl/example01.dbf
/home/oracle/app/oracle/oradata/orcl/APEX_19306134
55248703.dbf

/home/oracle/app/oracle/oradata/orcl/example02.dbf

7 rows selected.

SQL>

Some more useful links:
Regards,
TechOrNontech Team

No comments:

Post a Comment