A Oracle DBA's BLOG

Welcome to my ORACLE DBA blog. You will be Amazing!!!

Thursday, March 1, 2012

Startup And Shutdown Oracle Database Options

STARTUP ve SHUTDOWN

Before making Oracle Database available for any valid user, you must start up a database,
So startup have 3 mode 

1.NoMount mode,
2.Mount mode,
3.Open mode

Startup
When startup command is issued. Oracle looks for the parameter file in following order. SGA+BACKGROUND PROCESS Spifie<SID>.ora, init<SID>.ora

If we want to know the database on which instance. 
 " select open_mode from v$database " Using this command.

[oracle@orcl ~]$ su - oracle

[oracle@orcl ~]$ env | grep ORA
ORACLE_SID=ORCL
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
You can connect using either “/ as sysdba” or an oracle account that has DBA privilege.


[oracle@orcl ~]$ sqlplus '/ as sysdba'
SQL*Plus: Release 11.2.0.1.0 - Production on Sun Feb 20 10:40:28 2012
Copyright (c) 1982, 2009, Oracle.  All Rights Reserved.
Connected to an idle instance.
SQL>


 

SQL>startup; --> At first the database will go on "NOMOUNT" mode.
Then will go 
            MOUNT and at the final mode will be OPEN




NOMOUNT MODE: Oracle is reading paramater files (INITORA, SPFILE). 

It allocating memory(SGA), Starting backgraound processes. 

We can use "STARTUP QUIET"command in order to pass this option.
 SQL> startup nomount;
ORACLE instance started.

Total System Global Area  276197376 bytes
Fixed Size                  1335980 bytes
Variable Size             171969876 bytes
Database Buffers           96468992 bytes
Redo Buffers                6422528 bytes


MOUNT MODE: .The most important this is Oracle is reading Control files whichs instance mounted. Oracle check datafile and Log files. If there were any corruptions Oracle wont be open.

 ALTER DATABASE MOUNT; This command can be used when database is in nomount.



Database altered.
SQL> ALTER DATABASE OPEN; This comman can be used when database is in mounted. it will check datafiles and redolog files.


Database altered.
1) STARTUP [MOUNT/NOMOUNT/OPEN] RESTRICT; --> This comman is using for priviled User except this user others cant be connected in this mode How ever if any user have RESTRICTED SESSION role then its not up on that user.
SQL> ALTER SYSTEM  ENABLE RESTRICTED SESSION; For valid Restrict mode
SQL> ALTER SYSTEM  DISABLE RESTRICTED SESSION; For unvalid Restrict mode

select logins from v$instance; This select will show us the instance mode.


SQL> ALTER SYSTEM QUIESCE RESTRICTED; This command will wait until the active user 
finish trunsactions.
SQL> ALTER SYSTEM UNQUIESCE; 
SQL> select active_state from v$instance;

2) STARTUP [MOUNT/NOMOUNT/OPEN] FORCE; --> Database will be "SHUTDOWN ABORT" and then Opened again.
3) STARTUP [MOUNT/NOMOUNT/OPEN] EXCLUSIVE; -->This command will functionally identical to Above.


SHUTDOWN


1) SHUTDOWN [NORMAL]; --> The database waits for all users to disconnect, 
Oracle waits for all users to exit their sessions before shutting down the database
Oracle closes the data files and terminates the background processes. Oracle’s SGA is deallocated.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
2) SHUTDOWN IMMEDIATE; --> Oracle immediately disconnects all users. Oracle terminates all currently executing transactions.Oracle terminates the background processes and deallocates memory. No instance recovery is required on startup.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
3) SHUTDOWN ABORT; --> Oracle doesn’t roll back the terminated transactions. Oracle doesn’t write the redo log buffers and data buffers to disk.This doesn’t wait for anything. 

SQL> shutdown abort
ORACLE instance shut down.
SQL>





No comments:

Post a Comment