2. To check how many databases are on the server, either up or down...
cat /etc/oratab
3. To check the status of the instance...[Status can be either in NOMOUNT, MOUNT or OPEN]
sqlplus / as sysdba
select status from v$instance;
4. Different ways you can shutdown an Oracle database...
A) Shutdown (or Shutdown normal);
Blocks All connections immediately;
Wait for all connections to logout gracefully
Once all the connections are disconnected, database is marked as “shutdown completed”.
B) Shutdown transactional;
Blocks All connections immediately
Kills all connections that are “Select” only.
Wait for all DML (Delete, Update, Insert) transactions to end. Meaning? User has to either commit or rollback before the transaction is marked as completed.
Once all the DML transactions ends, database is marked as “shutdown completed”.
C) Shutdown immediate;
Blocks All connections immediately
Kills all connections.
Select are killed immediately;
Insert, Update and Deletes are rolled back to previous state.
D) Shutdown abort;
Kills the PMON process, hence database is not functional.
All connected “select only” queries are aborted and will be cleaned up by PMON process.
All DML transactions (transactions which were doing insert, update or delete) will be consider as “In-Doubt Transactions” during the next database started. At this point, SMON process will perform rollback or rollforward to mark the transaction complete.
5. How to startup the database so that users can read and write to database?
export ORACLE_SID=DatabaseName
(or)
. oraenv
sqlplus / as sysdba
startup
6. When “startup” is issued, what stages instance goes through before starting the database?
0
Closed
1
nomount
2
mount
3
open
Describe each stage.
nomount :-
Oracle assigns a small memory to the named instance.
Oracle Verifies initialization parameter file is available in $ORACLE_HOME/dbs location.
Default initialization parameter file in 12c and 19c is spfile
If spfile is not found, init$ORACLE.SID.ora will be referred to start the database.
Once the initialization parameter is finalized (spfile or pfile), Oracle will check the accuracy of each parameter inside the initialization parameter file. Verification process looks for the following:
All locations which are given to parameter are available on OS level. If the location is not valid, an error is trigged and recorded in alert log.
All numeric values should be valid. If they are not valid numers, an error is trigged and recorded in alert log.
Errors are also raised when typos are found. These errors are again recorded in alert log.
Listener is notified that the instance. However, the service is marked as “Blocked”
Once all of the above passes, instance status is moved to next step which is “mount” stage
mount :-
Oracle reads the initialization parameter file for the location of controlfile.