- 2 Starting Up and Shutting Down
- Starting Up the Database
- Starting Up the Data base from the Desktop
- Starting Up the Databas e Using the SQL Command Line
- Shutting Down the Database
- Shut ting Down the Database from the Desktop
- Shutti ng Down the Database Using the SQL Command Line
- 2 Stopping and Starting Oracle Software
- 2.1 Stopping and Starting Oracle Processes
- 2.1.1 Stopping and Starting Oracle Database and Oracle Automatic Storage Management Instances
- 2.1.1.1 Stopping an Oracle Database or Oracle Automatic Storage Management Instance
- 2.1.1.2 Restarting an Oracle Database or Oracle Automatic Storage Management Instance
- 2.1.2 Stopping and Starting Oracle Restart
- 2.2 Automating Shutdown and Startup
- 2.2.1 Automating Database Startup and Shutdown on Other Operating Systems
2 Starting Up and Shutting Down
This section describes how to start up and shut down Oracle Database Express Edition. It contains the following topics:
Starting Up the Database
Oracle Database Express Edition (Oracle Database XE) starts up automatically immediately after installation and after each system restart. Thus, there is no need to start up the database unless you previously shut it down.
You can start up the database from the desktop or with the SQL Command Line (SQL*Plus). Each of these methods is described in the following sections:
Starting Up the Data base from the Desktop
This section explains how to start up the database from the desktop in Windows and in the following two Linux windowing managers: KDE and Gnome. If your Linux computer is not running a windowing manager, or is running a windowing manager other than KDE or Gnome, you must start the database with the SQL Command Line. See «Starting Up the Database Using the SQL Command Line» for instructions.
To start up the database using the desktop:
Do one of the following:
On Windows: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a Windows administrator—that is, as a user who is a member of the Administrator group.
On Linux: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a user who is a member of the dba user group. This is typically the user oracle . See «Operating System Authentication» for more information.
Do one of the following:
On Windows: Click Start , point to Programs (or All Programs) , point to Oracle Database 11g Express Edition , and then select Start Database .
On Linux with Gnome: In the Applications menu, point to Oracle Database 11g Express Edition , and then select Start Database .
On Linux with KDE: Click the icon for the K Menu, point to Oracle Database 11g Express Edition , and then select Start Database .
Starting Up the Databas e Using the SQL Command Line
When you start up the database with the SQL Command Line, you must run the SQL Command Line on the same computer where you installed Oracle Database XE (the «Oracle Database XE host computer»).
To start up the database using the SQL Command Line:
Do one of the following:
On Windows: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a Windows administrator—that is, as a user who is a member of the Administrator group.
On Linux: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a user who is a member of the dba user group. This is typically the user oracle . See «Operating System Authentication» for more information.
If not already opened, open a terminal session or command window.
Linux platform only: Ensure that environment variables are set properly.
At the operating system prompt, enter the following command to start the SQL Command Line and connect to the database:
The slash (/) indicates that the database should authenticate you with operating system authentication.
At the SQL Command Line prompt, enter the following command:
If the command is successful, it displays output similar to the following. (System global area sizes will vary depending on the amount of physical memory in your Oracle Database XE host computer.)
(Optional) Enter the following SQL query to verify that the database started up properly:
The query results should look similar to the following:
To exit the SQL Command Line. enter the following command:
Shutting Down the Database
Oracle Database Express Edition (Oracle Database XE) shuts down automatically when you shut down the computer that hosts it. However, you can also shut Oracle Database XE down manually whenever you want, such as to reduce the overall system processing overhead when you do not need to use the database.
Before shutting down Oracle Database XE, it is best to ensure that all users and applications have completed their work and logged out. See «Monitoring Sessions» for information on how to view current database sessions.
If users or applications are still logged in when you begin a shutdown operation, the shutdown proceeds under the following conditions:
No new connections are permitted, and no new transactions are allowed to be started.
Any uncommitted transactions are rolled back.
All users and applications are immediately disconnected.
You can shut down the database with the desktop or with the SQL Command Line (SQL*Plus). Each of these methods is described in the following sections:
Shut ting Down the Database from the Desktop
This section explains how to shut down the database from the desktop in Windows and in the following two Linux windowing managers: KDE and Gnome. If your Linux computer is not running a windowing manager, or is running a windowing manager other than KDE or Gnome, you must shut down the database with the SQL Command Line.
To shut down the database using the desktop:
Do one of the following:
On Windows: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a Windows administrator—that is, as a user who is a member of the Administrator group.
On Linux: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a user who is a member of the dba user group. This is typically the user oracle . See «Operating System Authentication» for more information.
Do one of the following:
On Windows: Click Start , point to Programs (or All Programs) , point to Oracle Database 11g Express Edition , and then select Stop Database .
On Linux with Gnome: In the Applications menu, point to Oracle Database 11g Express Edition , and then select Stop Database .
On Linux with KDE: Click the icon for the K Menu, point to Oracle Database 11g Express Edition , and then select Stop Database .
Shutti ng Down the Database Using the SQL Command Line
When you shut down the database with the SQL Command Line, you must run the SQL Command Line on the same computer where you installed Oracle Database XE (the «Oracle Database XE host computer»).
To shut down the database using the SQL Command Line:
Do one of the following:
On Windows: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a Windows administrator—that is, as a user who is a member of the Administrator group.
On Linux: Log in to the Oracle Database XE host computer as the user that installed Oracle Database XE or as a user who is a member of the dba user group. This is typically the user oracle . See «Operating System Authentication» for more information.
If not already opened, open a terminal session or command window.
Linux platform only: Ensure that environment variables are set properly.
At the operating system prompt, enter the following command to start the SQL Command Line and connect to the database:
The slash (/) indicates that the database should authenticate you with operating system authentication.
At the SQL Command Line prompt, enter the following command:
Note that this command may take a short while to complete. If the command is successful, it displays the following output:
If the command displays no output after a number of minutes, indicating that the shutdown operation is not proceeding, you can press CTRL-C to interrupt the command, and then enter the following command:
The database must go through a recovery process when it starts up after a SHUTDOWN ABORT command. It is recommended that you enable the recovery process to take place immediately, after which you can shut down the database normally. To do this, enter the following commands when the SHUTDOWN ABORT completes:
See Oracle Database Administrator’s Guide for information on the SHUTDOWN ABORT command.
To exit the SQL Command Line. enter the following command:
Источник
2 Stopping and Starting Oracle Software
This chapter describes how to identify Oracle Database processes, and provides basic information about how to stop and restart them. It also describes how to set up automatic startup and shutdown of the Oracle Database. It contains the following sections:
When using Oracle Restart, you can use Service Control Utility (SRVCTL), a command-line interface, to manage Oracle processes (database instance, listener, Oracle ASM instance). With SRVCTL, you can manage the Oracle Restart configuration, see the status of processes managed by Oracle Restart, and start or stop processes such as Oracle Database. SRVCTL has been enhanced to support single instance databases with Oracle Restart on standalone servers and on clusters with Oracle Clusterware.
2.1 Stopping and Starting Oracle Processes
This section describes how to stop and start Oracle processes. It contains the following topics:
2.1.1 Stopping and Starting Oracle Database and Oracle Automatic Storage Management Instances
This section describes how to stop and start Oracle Database and Oracle Automatic Storage Management instances.
2.1.1.1 Stopping an Oracle Database or Oracle Automatic Storage Management Instance
Do not stop an Oracle Automatic Storage Management instance until you have stopped all Oracle Database instances that use Oracle Automatic Storage Management instance to manage their storage.
To stop an Oracle Database or Oracle Automatic Storage Management instance:
Run the following commands to identify the SID and Oracle home directory for the instance that must be shut down:
On Oracle Solaris:
On other operating systems:
The oratab file contains lines similar to the following, which identify the SID and corresponding Oracle home directory for each database or Oracle Automatic Storage Management instance on the system:
Oracle recommends that you use the plus sign (+) as the first character in the SID of Oracle Automatic Storage Management instances.
Run the oraenv or coraenv script, depending on the default shell, to set the environment variables for the instance that must be shut down:
Bourne, Bash, or Korn shell:
When prompted, specify the SID for the instance.
Run the following commands to shut down the instance:
After the instance shuts down, you can quit SQL*Plus.
2.1.1.2 Restarting an Oracle Database or Oracle Automatic Storage Management Instance
If the database instance uses Oracle Automatic Storage Management for storage management, then you must start the Oracle Automatic Storage Management instance before you start the database instance.
To restart an Oracle Database or Oracle Automatic Storage Management instance:
Repeat steps 1 and 2, if required, to set the ORACLE_SID and ORACLE_HOME environment variables to identify the SID and Oracle home directory for the instance you want to start.
Run the following commands to start the instance:
After the instance starts, you can exit from SQL*Plus.
2.1.2 Stopping and Starting Oracle Restart
To stop or start Oracle Restart, run the following command:
Start: This option is used to start Oracle Restart
Syntax and Options:
Stop: This option is used to stop Oracle Restart
Syntax and Options:
Oracle Database Administrator’s Guide for more information about the srvctl commands
2.2 Automating Shutdown and Startup
Oracle recommends that you configure the system to automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down. Automating database startup and shutdown guards against incorrect database shutdown.
To automate database startup and shutdown, use the dbstart and dbshut scripts, which are located in the $ORACLE_HOME/bin directory. The scripts refer to the same entries in the oratab file, which are applied on the same set of databases. You cannot, for example, have the dbstart script automatically start sid1 , sid2 , and sid3 , and have the dbshut script shut down only sid1 . However, you can specify that the dbshut script shuts down a set of databases while the dbstart script is not used at all. To do this, include a dbshut entry in the system shutdown file, but do not include the dbstart entry from the system startup files.
The init command in the operating system documentation for more information about system startup and shutdown procedures
2.2.1 Automating Database Startup and Shutdown on Other Operating Systems
To automate database startup and shutdown by using the dbstart and dbshut scripts:
Log in as the root user.
Edit the oratab file for the platform.
To open the file, use one of the following commands:
On Oracle Solaris:
On IBM AIX on POWER Systems (64-Bit) and Linux:
Database entries in the oratab file are displayed in the following format:
In this example, the values Y and N specify whether you want the scripts to start or shut down the database, respectively. For each database for which you want to automate shutdown and startup, first determine the instance identifier (SID) for that database, which is identified by the SID in the first field. Then, change the last field for each to Y .
You can set dbstart to autostart a single-instance database which uses an Automatic Storage Management installation auto-started by Oracle Clusterware. This is the default behavior for an Automatic Storage Management cluster. To do this, you must change the oratab entry of the database and the Automatic Storage Management installation to use a third field with the value W and N , respectively. These values specify that dbstart auto-starts the database only after the Automatic Storage Management instance is started.
If you add new database instances to the system and automate the startup for them, then you must edit the entries for those instances in the oratab file.
Change directory to one of the following, depending on the operating system:
Platform | Initialization File Directory |
---|---|
Linux and Oracle Solaris | /etc/init.d |
IBM AIX on POWER Systems (64-Bit) | /etc |
Create a file called dbora , and copy the following lines into this file:
Change the value of the ORACLE_HOME environment variable to specify the Oracle home directory for the installation. Change the value of the ORACLE environment variable to the user name of the owner of the database installed in the Oracle home directory (typically, oracle ).
This script can only stop Oracle Net listener for which a password has not been set. In addition, if the listener name is not the default name, LISTENER , then you must specify the listener name in the stop and start commands:
Change the group of the dbora file to the OSDBA group (typically dba ), and set the permissions to 750:
Create symbolic links to the dbora script in the appropriate run-level script directories, as follows:
Источник