Home > Database > Oracle > oracle close database

oracle close database

王林
Release: 2023-05-07 20:22:36
Original
1277 people have browsed it

When using the Oracle database, sometimes you need to shut it down. This may be for maintenance, backup, or other operations. Regardless of the reason, shutting down an Oracle database is not a simple task and requires certain understanding and skills. In this article, we will explain how to shut down an Oracle database.

  1. Close the background process

Before closing the Oracle database, you need to close the background process first. The background process is created when the Oracle instance starts and is used to manage the running of the database instance. You need to log in to the Oracle server using an operating system account and run the following command to shut down the background process:

$ sqlplus / as sysdba
SQL> shutdown immediate;
Copy after login
Copy after login

This command will shut down the Oracle database, including currently ongoing transactions. Before shutting down the database, Oracle stores all data on disk so that it can be reloaded the next time it is started.

  1. Close the listener

Before closing the Oracle database, you need to close the listener first. A listener is a process that receives client connection requests. You need to log in to the Oracle server using an operating system account and run the following command to close the listener:

$ lsnrctl stop;
Copy after login

This command will close the currently running listener. With this command, the Oracle database can no longer access connection requests from the client.

  1. Close the Oracle database instance

Before closing the database instance, you need to stop the currently running instance. You need to log in to the Oracle server using an operating system account and run the following command to shut down the instance:

$ sqlplus / as sysdba
SQL> shutdown immediate;
Copy after login
Copy after login

This command will stop each database instance and all processes in it. After the instance is shut down, the Oracle database will no longer provide services.

  1. Close the database in Oracle RAC environment

In Oracle Real Application Clusters (RAC) environment, you need to shut down the database instance on each node. You need to use the command line tool or any GUI tool to log in to each node in the Oracle RAC cluster as an administrator, and use the following command to shut down the Oracle database instance and listener:

$ srvctl stop instance -d dbname -i instance_name
$ srvctl stop listener -l listener_name
Copy after login

In the above command, dbname represents the database Name, instance_name represents the database instance name in the RAC environment, and listener_name represents the listener name. After executing the above command, the Oracle database will no longer provide external services. This needs to be done on every node.

Summary

With the above steps, you can easily shut down the Oracle database. Please make sure you back up your database before doing this, just in case something unexpected happens. Shutting down an Oracle database will suspend all its operations until the next startup. If you need to perform operations on the Oracle database, make sure to back up before shutting down and restore immediately after shutting down.

The above is the detailed content of oracle close database. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template