How Can I Tell If An Oracle Database Is Mounted and Activated?
How Can I Tell If An Oracle Database Is Mounted and Activated?
When the instance is started, the init*.ora file is read by the system and SGA is allocated as
per the initialization parameters. No database is associated with this instance.
Once you Mount the database, it is asoociated with the instance. The contol file of the DB is
read and db files, redo log files and rollback segments, all are associated with the instance.
(these files are not yet 'open') That is why this state is used for moving around the db files.
When the database is started or opened, all these files are open and available for use to
the users
Startup Nomount : Read the parameter file and start the instance.
Instance name identified by ORACLE_SID env parameter.
The parameter file controls such things as SGA size, database name that can connect to this
instance.
Database not associated with instance yet.
As an example, you may need to do this if you will mount a standby database.
Mount : Associates database with the instance.
Open and read control files
Establish physical files associated with database. i.e location, size, amount of redo log files.
Physical database file names and locations.
DBA may need to be in mount state for all kinds of DBA activity.
examples :
rename/move system datafile.
put database in archivelog mode.
Database not yet available for user connections.
Opened/started
Ensure physical files exist.
make available for normal operations.
open online datafiles, redo logs.
acquire rollback segments.
These states are useful in many situations to a DBA, main areas where these are useful are ;
Architecture/Admin
Backup/Recovery.
*********************************************************************************
Starting Up an Instance
You use the SQL*Plus STARTUP command to start up an Oracle Database instance. You can start an
instance in various modes:
Start the instance without mounting a database. This does not allow access to
the database and usually would be done only for database creation or the recreation of control files.
Start the instance and mount the database, but leave it closed. This state allows
for certain DBA activities, but does not allow general access to the database.
Start the instance, and mount and open the database. This can be done in
unrestricted mode, allowing access to all users, or in restricted mode, allowing
access for database administrators only.
Force the instance to start after a startup or shutdown problem, or start the
instance and have complete media recovery begin immediately.
*************************************************************************************
In this example from a Windows XP server, we set the ORACLE_SID to the name of
the database and we log into SQL*Plus using the ?sys as sysdba? login. This gives us
the privileges we need to be able to startup the database. Finally, after we enter our
password, we issue the startup command to startup the database. Oracle displays its
progress as it opens the database, and then returns us to the SQL*Plus prompt once
the startup has been completed.
When Oracle is trying to open your database, it goes through three distinct stages, and
each of these is listed in the startup output listed previously. These stages are:
* Startup (nomount)
* Mount
* Open
Let?s look at these stages in a bit more detail.
*************************************************************************************
591396864 bytes
1291916 bytes
167774580 bytes
415236096 bytes
7094272 bytes
1. DB's and 2. CONTROLFILES.
Type
NUMBER
VARCHAR2(16)
VARCHAR2(64)
VARCHAR2(17)
DATE
VARCHAR2(12)
PARALLEL
THREAD#
ARCHIVER
LOG_SWITCH_WAIT
LOGINS
SHUTDOWN_PENDING
DATABASE_STATUS
INSTANCE_ROLE
ACTIVE_STATE
BLOCKED
VARCHAR2(3)
NUMBER
VARCHAR2(7)
VARCHAR2(15)
VARCHAR2(10)
VARCHAR2(3)
VARCHAR2(17)
VARCHAR2(18)
VARCHAR2(9)
VARCHAR2(3)
Type
VARCHAR2(7)
VARCHAR2(513)
VARCHAR2(3)
NUMBER
NUMBER
Type
NUMBER
VARCHAR2(9)
DATE
NUMBER
DATE
NUMBER
DATE
VARCHAR2(12)
NUMBER
NUMBER
VARCHAR2(7)
DATE
NUMBER
NUMBER
CONTROLFILE_TIME
OPEN_RESETLOGS
VERSION_TIME
OPEN_MODE
PROTECTION_MODE
PROTECTION_LEVEL
REMOTE_ARCHIVE
ACTIVATION#
SWITCHOVER#
DATABASE_ROLE
ARCHIVELOG_CHANGE#
ARCHIVELOG_COMPRESSION
SWITCHOVER_STATUS
DATAGUARD_BROKER
GUARD_STATUS
SUPPLEMENTAL_LOG_DATA_MIN
SUPPLEMENTAL_LOG_DATA_PK
SUPPLEMENTAL_LOG_DATA_UI
FORCE_LOGGING
PLATFORM_ID
PLATFORM_NAME
RECOVERY_TARGET_INCARNATION#
LAST_OPEN_INCARNATION#
CURRENT_SCN
FLASHBACK_ON
SUPPLEMENTAL_LOG_DATA_FK
SUPPLEMENTAL_LOG_DATA_ALL
DB_UNIQUE_NAME
STANDBY_BECAME_PRIMARY_SCN
FS_FAILOVER_STATUS
FS_FAILOVER_CURRENT_TARGET
FS_FAILOVER_THRESHOLD
FS_FAILOVER_OBSERVER_PRESENT
FS_FAILOVER_OBSERVER_HOST
DATE
VARCHAR2(11)
DATE
VARCHAR2(10)
VARCHAR2(20)
VARCHAR2(20)
VARCHAR2(8)
NUMBER
NUMBER
VARCHAR2(16)
NUMBER
VARCHAR2(8)
VARCHAR2(20)
VARCHAR2(8)
VARCHAR2(7)
VARCHAR2(8)
VARCHAR2(3)
VARCHAR2(3)
VARCHAR2(3)
NUMBER
VARCHAR2(101)
NUMBER
NUMBER
NUMBER
VARCHAR2(18)
VARCHAR2(3)
VARCHAR2(3)
VARCHAR2(30)
NUMBER
VARCHAR2(21)
VARCHAR2(30)
NUMBER
VARCHAR2(7)
VARCHAR2(512)
now in nomount mode, the database SGA and Background process have been initialized only. Only
Instance is created, however, the database can not be queried as it is not initialized, as well as,
CONTROL FILES HAVE YET NOT BEEN READ, although they are present in the INIT.ORA file. They
be read in the Next Mode.
16384
430
C:\HARRY\HARRY\CONTR NO
OL03.CTL
16384
430
Now that the Database is MOUNTED, Oracle can read the Control files and knows where all the
datafiles are present.
Control file has pointers that provide connection b/w Datafiles, Redo Logs, Archived Logs, Memory and
Last Updated SCN.
SQL> select * from v$log;
GROUP#
THREAD# SEQUENCE#
BYTES
MEMBERS ARC STATUS
FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------------------- --------1
1
23
52428800
1 YES INACTIVE
959048 23-JUN-11
3
1
25
52428800
1 NO CURRENT
1033570 25-JUN-11
2
1
24
52428800
1 YES INACTIVE
996350 24-JUN-11
SQL> select * from v$logfile;
GROUP# STATUS
---------- ------3
2 STALE
1
TYPE
------ONLINE
ONLINE
ONLINE
MEMBER
------------------------C:\HARRY\HARRY\REDO03.LOG
C:\HARRY\HARRY\REDO02.LOG
C:\HARRY\HARRY\REDO01.LOG
IS_RECOVERY_DEST_FILE
--------------------NO
NO
NO
Archive Mode
Enabled
USE_DB_RECOVERY_FILE_DEST
23
25
25
So from here, we can see that the Database in Mount Mode has all the required
parameters initialized,
however the database itself is still not open to users.
MOUNT MODE IS WHERE MAINTENANCE WORK IS DONE.
SQL> ALTER DATABASE OPEN;
Database altered.
SQL> select instance_name, status from v$instance;
INSTANCE_NAME
STATUS
---------------- -----------harry
OPEN
SQL> SELECT NAME, OPEN_MODE FROM V$DATABASE;
NAME
OPEN_MODE
-------------------- ---------HARRY
READ WRITE
Now the database is open for use.
IN A NUTSHELL:
SQL> startup nomount
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
591396864
1291916
289409396
293601280
7094272
bytes
bytes
bytes
bytes
bytes
Database altered.
SQL> select instance_name, status from v$instance;
INSTANCE_NAME
STATUS
---------------- -----------harry
MOUNTED
SQL> alter database open;
Database altered.
SQL> select instance_name, status from v$instance;
INSTANCE_NAME
STATUS
---------------- -----------harry
OPEN