[Oracle Notes] 3. Oracle startup and Shutdown

Source: Internet
Author: User

Oracle startup and Shutdown
I. startup and shutdown processes
Startup: shutdown → nomount (routine startup) → mount → open
Shutdown: open → mount → nomount → shutdown
Ii. startup routine (nomount)
The startup routine puts the database in the nomount state. It is generally used to create a database or re-create a control file.
The startup routine includes the following tasks:
Read the initialization file from $ ORACLE_HOME/dbs in the following order:
First read spfileSID. ora
If not, read spfile. ora
If not found, read initSID. ora
You can use startup to specify the pfile parameter to overwrite the default behavior.
Allocate SGA
Start background processes
Open alertSID. log
Iii. Load the database (mount)
Start the routine and load the database, but do not open the database so that the database is in the mount state. It is generally used to perform specific maintenance operations, such as renaming database files, enabling and disabling redo log archiving options, perform full database recovery.
Loading a database includes the following tasks:
Associate a database with a previously started routine
Locate and open the specified control file in the parameter file
Read the control file to obtain the name and status of the data file and redo log file. However, check whether the data files and redo log files exist at this time.
4. open a database)
Open the database to make the database open. Any valid user can connect to the database and perform normal data access.
Opening the database includes the following tasks:
Open Online Data Files
Open Online redo log file
The oracle Server verifies that all data files and redo log files can be opened and the data consistency is checked. If necessary, the system monitoring (SMON) background process will start the routine recovery operation.
V. startup command
To start a routine, run the following command:
Startup [force] [restrict] [pfile = filename] [open [recover] [database] | mount | nomount]
Where:
Open: allows users to access the database
Mount: attach a database for certain DBA activities, but the user is not allowed to access the database
Nomount: creates an SGA instance and starts background processes, but does not allow access to the database.
Pfile = filename: allow non-default parameter file configuration routines
Force: Execute the routine that stops running before normal startup (generally not recommended, may cause database damage and cannot be started)
Restrict: only users with restrict session permission can access the database.
Recover: starts to recover the media when the database is started (generally, it is not recommended to use it, and data is easy to lose)
Vi. alter databasa command
To change the database from nomount to mount or from mount to open, use the alter database Command
Alter database {mount | open}
To modify textile data by user transactions, you can open the database in read-only mode.
Alter database open [read write | read only]
Read write: Open the database in read/write mode to generate redo logs.
Read only: restrict users to read-only transactions. Textile users generate redo logs.
This mode can be used
Execute Query
Sort disks using locally managed tablespaces
Offline and online data files (rather than tablespaces)
Restore offline data files and tablespaces
7. Open the database in restricted mode
When performing Structure Maintenance or Database Import and Export, start the database in restricted mode. In this way, only users with restrict session permission can use the database. You can also use the alter system SQL command to set the database to the restricted mode:
Alter system [{enable | disable} restricted session]
Enable: only users with restricted session permissions are allowed to log on later
Disable: disable restrict session to allow users without this permission to log on
After you place the routine in restricted mode, you can use the following command to terminate all the current sessions.
Alter system kill session 'integer1, integer2'
Integer1: value of the SID column in the V $ session View
Integer2: value of the serial # column in the V $ session View
After executing this command, PMON will perform the following operations:
Roll back the current user transaction
Release all currently held tables or row locks
Releases all resources currently reserved by the user.
8. Shut down the database
Disabling the database will lead to offline backup of all the physical structures, and the modified static initialization parameters will take effect after the restart. There are four modes: abort, immediate, transactional, normal
To close the database, you must use the command as sysoper or sysdba.
Shutdown [normal | transactional | immediate | abort]
9. Close the database cleanly
You can use normal, transactional, and immediate operations to close the database and clean the database process.
Write the content that the database buffer tells the cache to the data file during the shutdown process.
Roll back uncommitted changes
Release resources
No routine recovery occurs during startup.
Close normally
Normal is the default close mode. Disable normal protective gear in the following situations
No new connection is created.
The oracle server is closed only after all users are disconnected.
The content in the database and redo log buffer has been written to the disk.
Background process terminated, SGA deleted from memory
Oracle will close and uninstall the database before closing the routine
Routine recovery is not required at next startup.
Transaction closure (transactional) prevents client loss of work, in the following circumstances
No client can start new things on this particular routine
Disconnect the client when the client ends the ongoing transaction
Close immediately after all transactions are completed
Routine recovery is not required at next startup.
Disable immediately (immediate) in the following circumstances
The current SQL statement processed by oracle is incomplete
The oracle server does not wait for the user currently connected to the database to be disconnected.
Oracle rolls back active transactions and disconnects all connected users
Oracle will close and uninstall the database before closing the routine
Routine recovery is not required at next startup.
10. Shut down the database abnormally
When you use the abort operation to shut down a database, the operation usually takes the following steps:
The modified cache content is not written into the data file.
Do not roll back uncommitted changes
Use close termination force close data will cause Database Inconsistency
The changes will be re-applied using the redo log during startup.
Uncommitted changes are rolled back using withdrawal segments
Release resources
This operation is easy to cause database faults and thus cannot be enabled. It is not recommended to use
This operation is generally used in the following scenarios:
The current SQL statement processed by the oracle server is terminated immediately.
Oracle does not wait for the user currently connected to the database to be disconnected
The content in the database and redo buffer is not written to the disk.
Uncommitted transactions are not rolled back.
The routine is terminated without closing the file.
The database is not closed or uninstalled.
The recovery routine is required to be started next time. This operation will be performed automatically
We recommend that you do not back up a database in an inconsistent state.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.