Shut down the Oracle database at Linux Startup

Source: Internet
Author: User
Tags sqlplus

Oracle databases are heavyweight, and their management is very complicated. Sort out the steps for starting and disabling Oracle databases on the Linux platform.

After installing Oracle, you need to create an ORACLE System User and add several environment variables in. bash_profile under/home/Oracle: oracle_sid, oracle_base, ORACLE_HOME. For example:

Export oracle_sid = test export oracle_base = oracle_install_dir export ORACLE_HOME = xxx

Start step: Pay attention to $ representing the shell command prompt. Here, Oracle is version 9.0 or later.

  1. $ Su-Oracle
  2. $ Sqlplus/nolog
  3. SQL> Conn/As sysdba
  4. SQL> startup (generally, you do not need to add parameters. You only need to set environment variables)
  5. SQL> quit (exit SQL Mode)
  6. $ LSNRCTL start (start listener)

Disable Oracle

  1. $ LSNRCTL stop (close the listener. Close the application before that)
  2. $ Sqlplus/nolog
  3. SQL> shutdown: the shutdown parameter has four parameters. The meanings of the four parameters are as follows:
    Normal: wait until all users are disconnected.
    Immediate waits for the user to complete the current statement
    Transactional waits for the user to complete the current transaction
    Abort closes the database without waiting.
    Normal requires that you close the database only after all connected users are disconnected. Sometimes it seems that the command is not running! New connections are not allowed after this command is executed.
    Immediate disconnects the user after the user executes the statement being executed, and does not allow new users to connect.
    Transactional disconnects after it supports executing the current transaction and does not allow new users to connect to the database.
    Abort forcibly disconnects and closes the database.
    The first three methods do not return lost user data. The fourth option is not recommended if it is no longer available!

Frequently encountered problems:

1) permission issues, solution, switch to Oracle user;

2) The Listener is not closed. Solution: Disable the listener.

3) If an oracle instance is not closed, the solution is to close the Oracle instance.

4) The environment variable settings are incomplete. Solution: Modify the environment variable.

Oracle Database startup and shutdown Methods

I. Several startup methods:

1. startup nomount
Non-installation startup. In this mode, you can execute: re-build the control file and re-build the database.
Start the instance, that is, start the SGA and background processes. To start the instance, you only need the init. ora file.
2. startup Mount dbname
Install and start. In this mode, you can execute: Database Log archiving, database recovery, and renaming some database files.
For example, system tablespace or log files.
Execute "nomount" and open the control file.
3. startup open dbname
Run "nomount" first, then "Mount", and then open all database files including the redo log file,
In this way, you can access data in the database.
4. startup, which is equal to the following three commands
Startup nomount
Alter database Mount
Alter database open
5. startup restrict
Constraint-based startup
This method can start the database, but only allow access by users with certain privileges
When a non-authorized user accesses the service, the following prompt is displayed:
Error:
ORA-01035: Oracle only allows users with restricted session Permissions
6. startup force
Force start Mode
When the database cannot be closed, you can use startup force to close the database.
Shut down the database first, and then execute the normal database startup command
7. startup pfile = parameter file name
Startup method with initialization parameter file
Read the parameter file first, and then start the database according to the settings in the parameter file.
Example: startup pfile = E:/Oracle/admin/oradb/pfile/init. ora
8. startup exclusive

Ii. Closing methods:

1. Shutdown normal
Close the database normally.
2. Shutdown immediate
Close the database immediately.
Run shutdown immediate in svrmgrl, and the database is not closed immediately,
However, it is disabled only after Oracle executes some cleanup tasks (terminating sessions and releasing session resources ),
When you use shutdown to close a database, shutdown immediate can be used to close the database.
3. Shutdown abort
Directly shut down the database, and the session accessing the database will be suddenly terminated,
If a large number of operations are being performed in the database, it takes a long time to restart the database after the shutdown abort command is executed.

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 13483

1. Start

Syntax: startup [force] [pfile = file name] [exclusive | shared] [Mount database name | normal database name] [nomount]

1. normal startup:

SQL> conn sys/sys as sysdba;

SQL> startup

You can also specify the database name at startup.

SQL> startup ora9

2. Installation and non-installation start

The installation and startup options are mount, indicating that the routine only loads the database, but does not open the database. The option not to install and start is nomount, indicating that only the database is created and not loaded into the database, of course, it cannot be opened.

SQL> startup Mount -- install and start

SQL> startup nomount -- start without Installation

3. Exclusive and shared startup

Exclusive indicates that only one routine is allowed to use the database. The shared startup parameter is shared, indicating that multiple routines can be used in parallel to load the database into multiple sites.

4. constraint start

The restricted start option is restrict. When a database is started, the database can only be used by database administrators with special permissions. Generally, users cannot join the database.

SQL> startup restrict

Generally, when a user has the create session permission, the user can join the database. However, for a database started in restrict mode, only the user has the restricted session system permission can join the database.

To change this mode during database running, use the alter system command.

SQL> alter system disable restricted session;

You can also shut down the database before starting the database again in non-Restrict mode.

5. Force start

If you encounter some trouble when you start the database normally, or the database cannot be shut down normally when you shut down the database last time, you can use force start. The option is force.

Connecting sys users

SQL> startup force

6. Start the file with initialization parameters

The initialization parameter file is read by the system when the database is started. Some global parameters are set, which does not affect the running mode of the database.

SQL> startup pfile = D:/Oracle/admin/site/pfile/init. ora

Tip: You can use alter database to perform some startup mode conversion, but the conversion type is very limited. For example, to open a database in Mount mode, you can use the following command:

SQL> alter database open;

You can also change from the Mount status to the Mount status, as shown below:

SQL> alter database Mount;

Ii. Disable

1. Close normally

The option used to close the database normally is normal. Before the database is closed, all connections will be checked, and new user connections will not be allowed after the command is issued, and the database will be closed after all connections are closed, you do not need to recover the database again.

Connecting sys users

SQL> shutdown normal;

2. Emergency closure

This method is used in some emergency situations, such as notifying that a power outage is triggered immediately. In this case, the database needs to be closed urgently to cope with these situations. The option used in this method is immediate. In this method, the system disconnects and closes the database instead of waiting for all users to disconnect and close the connection.

SQL> shutdown immediate;

Once this command is executed, the SQL statement being processed will be immediately stopped, and all uncommitted transactions will be rolled back without waiting for the user currently connecting to the database to disconnect, instead, the system forcibly disconnects each connection. The next time you start the database, you need to perform the recovery action, but it is automatically executed by the system. You do not have to know about it.

3. Disable exceptions

In this way, the system does not perform any checks, disconnections, or rollback operations, but directly removes the database from the site. In this way, the database data on the site is of course invalid, the database is naturally shut down.

SQL> shutdown abort;

When the database is closed in abort mode, only one row of closing information indicates that the database site is closed. A database that is closed in abort mode must be restored when it is restarted. These recovery operations are also completed automatically by the system and take a long time.

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 85205

Related Article

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.