Bounce Oracle Database – NON-RAC

Check connectivity on the database prior to any shutdown commands:

–Find any open transactions – DML only. will not return SELECTS
select * from gv$transaction;

–Find any runing scheduler jobs
select * from dba_scheduler_running_jobs; 

–find any running jobs
select * from dba_jobs where THIS_DATE is not null;

–Check was is broken prior to Bounce
select * from dba_jobs where broken = ‘Y’;

–Check any open sessions
select * from gv$session;

–Check if services have closed properly or whether still active
select * from v$ACTIVE_SERVICES

–Useful syntax to find system views/tables
select * from dict where lower(comments) like ‘%service%’;

Then log on to the node which holds the database to be shutdown.

To stop the database using srvctl

— database status. Verbose to show active services
> Srvctl status database –d IAPP1 –v

— to prevent any new connections via services to the database. This will not kill active connections
> Srvctl stop service –d IAPP1

— database can be stopped via srvctl in a cluster
> Srvctl stop database –d IAPP1

To stop the database manually

> Ps –ef | grep pmon
> Sqlplus / as sysdba

Shutdown immediate;

Database startup modes

The Startup (nomount) Stage

When you issue the startup command, the first thing the database will do is enter the nomount stage. During the nomount stage, Oracle first opens and reads the initialization parameter file (init.ora) to see how the database is configured. For example, the sizes of all of the memory areas in Oracle are defined within the parameter file.

After the parameter file is accessed, the memory areas associated with the database instance are allocated. Also, during the nomount stage, the Oracle background processes are started. Together, we call these processes and the associated allocated memory the Oracle instance. Once the instance has started successfully, the database is considered to be in the nomount stage. If you issue the startup command, then Oracle will automatically move onto the next stage of the startup, the mount stage

The Mount Stage

When the startup command enters the mount stage, it opens and reads the control file. The control file is a binary file that tracks important database information, such as the location of the database datafiles.

In the mount stage, Oracle determines the location of the datafiles, but does not yet open them. Once the datafile locations have been identified, the database is ready to be opened.

The Open Oracle startup Stage

The last startup step for an Oracle database is the open stage. When Oracle opens the database, it accesses all of the datafiles associated with the database. Once it has accessed the database datafiles, Oracle makes sure that all of the database datafiles are consistent.

Opening the Database in Restricted Mode

You can also start the database in restricted mode. Restricted mode will only allow users with special privileges (we will discuss user privileges in a later chapter) to access the database (typically DBA’s), even though the database is technically open. We use the startup restrict command to open the database in restricted mode as seen in this example.

SQL> startup restrict

You can take the database in and out of restricted mode with the alter database command as seen in this example:

— Put the database in restricted session mode.
SQL> alter system enable restricted session;

— Take the database out of restricted session mode.
SQL> alter system disable restricted session;

Note:  Any users connected to the Oracle instance when going into restricted mode will remain connected; they must be manually disconnected from the database by exiting gracefully or by the DBA with the “alter system kill session” command.

To start the database using srvctl

Srvctl start database –d IAPP1

–Services do not explicitly start…
Srvctl start service –d IAPP1 

–Check that services have started
srvctl status database d IAPP1 v

To start the database manually

> Sqlplus / as sysdba

–reading the spfile/ initialization file
Startup nomount; 

–opens and reads the control file.
Alter database mount;

–datafiles associated with the database are accessed, and the datafile consistency is checked.
Alter database open;

–Check listener LISTENER_nodename
Lsnrctl status LISTENER_tcygd07

Check the alert log if the database is taking a long time to start

> cd admin
> cd IAPP1
> cd bdump
> tail 200 alertlog_IAPP1.log