Steps and problem solving for Oracle switching to archive mode _oracle

Source: Internet
Author: User
Tags oracle database installation oracle database

Direct title

View the current database schema

Connect into the database, type the following command:

Copy Code code as follows:

sql> archive log list;

You can view the mode of the current database, and if the database log mode is not archived mode, the following switching process is necessary.

Before you switch, make sure that the following parameters are set

The Log_archive_dest_n parameter sets the archive log target, where n is replaced with a number. In Oracle9i, the range of n is 1~5, and in oracle10g, n can take a value of 1~10. Set up the following way:

Copy Code code as follows:

Sql> alter system set log_archive_dest_1= "Location=path" Scope=both;

Where path is the folder path where the archived log files are stored. The final scope=both is to apply the settings to the current database instance, and to save the parameter settings to SPFile, which directly loads the parameter information in the SPFile when the database restarts.
You can set multiple archive log destinations. Setting multiple targets, archiving log files can be saved as multiple archived versions at the same time, setting multiple targets is a good habit, although there seems to be no need to ^_^ before the problem occurs

Close Database

Copy Code code as follows:

sql> shutdown Immediate

Shutting down a database is generally not a problem, but after the database is put into use, shutting down the database must be compelling (even if you are deliberately shutting it down, you have to be very compelled to do it, hehe)-it's best to make sure that no one is using the database, or else you are ^_^.

Startup database is suspend (mount) status

Copy Code code as follows:

Sql> Startup Mount

In this step, the real problem arises. The mount has never been a startup for several times, saying that the listener cannot listen to your current routine. Of course, if the listener is properly configured, this type of problem will not appear here. Since there is a problem with the listener, then start from here to solve. In the Oracle Database installation directory (the path may be: E:\oracle\product\10.2.0\db_1\NETWORK\ADMIN) You can find listener.ora such parameter files, available in Notepad to open them for editing and saving. It's not advisable to manually modify this file directly, because the parentheses can kill countless brain cells. Installing Oracle is typically the default installation of the Net Manager component, which can help you easily configure annoying listener parameters:
Oracle NET Configuration listener LISTENER, select Database services in the top-most drop-down box on the right side of the form. If you haven't been listening to the database service, then that's the key to your problem solving. Add the database, and the global database and SID are set to the same values as the service_name in the Tnsnames.ora file (Note: Tnsnames.ora files are in the same directory as the Listener.ora file). Save, there will be some more settings in the Listener.ora, as follows:

Copy Code code as follows:

Sid_list_listener =
(Sid_list =
(Sid_desc =
(Global_dbname = ORCL)
(Oracle_home = E:\oracle\product\10.2.0\db_1)
(Sid_name = ORCL)
)
)

The red part of the formal listener does not configure the full content, now configured it, then the above can not make the database into a suspended state of the problem will be resolved. Note that the above assumption is that the service_name in the Tnsnames.ora file is ORCL. Of course, when the listener parameters are configured and not immediately applied to the listener, we also need to reload the listener into the command line:

Copy Code code as follows:

C:\>lsnrctl
Lsnrctl> Reload

Reconnect the database once, the result is "connected to an idle routine." At this point, then startup Mount, you can successfully enter the suspend state.

Toggle mode in a suspended state of a database routine

Copy Code code as follows:

Sql> alter system archivelog;

Tip the database has changed. After you open the database, use the archive log list to view the current mode: the database log mode archive mode.

Open Database

Copy Code code as follows:

sql> ALTER DATABASE open;

A suspended state of a database is not a true state of being available, and only open databases are routines that are available for use in the run.

End work

Turn on automatic archiving

Copy Code code as follows:

Sql> alter system set Log_archive_start = true; Scope=both;

Manual filing;

Copy Code code as follows:

sql> alter system switch logfile; --manual archiving to detect whether the above settings have been applied to the current database

Set the Flash area size

Copy Code code as follows:

Sql> alter system set db_recovery_file_dest_size=5368709102; --5g

Other issues
In the process of switching mode I also encountered a problem, that is, when I use WordPad to open SPFile accidentally saved. Small save brings a big problem, SPFile is a binary file, although WordPad can open the normal browsing most of the contents of the file is unable to read the file ID (normally use WordPad to open the file the first line is garbled, the key AH). Save, get, SPFile is changed to ordinary text, people are good to read, but Oracle do not know. There is no way to build a new chant.

Rebuilding SPFile requires pfile in the system. Pfile good place is that it is a text file ^_^ generally build the database at the same time it has been created, its path may be as follows: E:\oracle\product\10.2.0\admin\orcl\pfile\. Under this path, there is a file that begins with the file name of Init.ora. The end of the file name is a string of digits (by default). Connect to the database idle routine as SYSDBA (no SPFile database cannot be started, can only connect to an idle routine such as: Conn/as SYSDBA), and the command to rebuild SPFile is as follows:

Copy Code code as follows:

sql> Create spfile= ' E:\oracle\product\10.2.0\db_1\dbs\SPFILEORCL. ORA ' from pfile= ' e:\oracle\product\10.2.0\admin\orcl\pfile\init.ora.************ ';

If the rebuild succeeds, the prompt is "file created." After you create a new spfile, the database will start up normally, but remember to alter system set ... scope=spfile to change the contents of SPFile.

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.