Get the App
SLTechnology News&Howtos  ›  Database  › 

Control file multiplexing

Shulou Source: shulou.com Published: 2022-06-01 07:38:24 10月03日 Update

Control file is one of the most important files in oracle database. It records the name of the database and other key configurations, as well as the location and status of all the data files and log files in the current database. It is a key file that must be found and used in the process of database startup. By default, there are two control files in the database, and the contents and sizes of the two control files are the same. In a production environment, it is common to build multiple copies of control files on different disks. It should be noted that no matter how many control files the database has, when the database starts, it will check all the control files, and only if the contents of these control files are consistent and undamaged can the database start successfully.

Method 1:

View the current control file of the database

SQL > show parameter control_files

NAME TYPE VALUE

Control_files string / u01/app/oracle/oradata/orcl/control01.ctl

/ u01/app/oracle/oradata/orcl/control02.ctl

two。 Modify control file

SQL > alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl','/u01/app/oracle/control/control03.ctl' scope=spfile

System altered.

3. Consistency shuts down database

SQL > shutdown immediate

4. Copy the control file to the appropriate directory in the operating system

[oracle@ymm oracle] $cp / u01/app/oracle/oradata/orcl/control01.ctl / u01/app/oracle/control/control03.ctl

5. Start the database

SQL > startup

6. View the current control file of the database

SQL > show parameter control_files

NAME TYPE VALUE

-

Control_files string / u01/app/oracle/oradata/orcl/control01.ctl

/ u01/app/oracle/oradata/orcl/control02.ctl

/ u01/app/oracle/control/control03.ctl

Method 2: modify the parameter file pfile

Generate pfile parameter file

SQL > show parameter spfile

NAME TYPE VALUE

Spfile string / u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora

SQL > create pfile from spfile

File created.

By default, both pfile and spfile are stored in the $ORACLE_HOME/dbs directory. Pfile begins with init and spfile begins with spfile.

two。 Consistency shuts down database

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

3. Modify control file parameters in pfile

[oracle@ymm dbs] $vi initorcl.ora

4. Copy control file copy

[oracle@ymm control] $cp control03.ctl control04.ctl-- I copy in a relative path without adding a path

[oracle@ymm control] $ls

Control03.ctl control04.ctl

5. Regenerate spfile and start the database

SQL > create spfile from pfile

File created.

SQL > startup

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 239075696 bytes

Database Buffers 482344960 bytes

Redo Buffers 7061504 bytes

Database mounted.

Database opened.

6. Check the status of control files

SQL > show parameter control_files

NAME TYPE VALUE

Control_files string / u01/app/oracle/oradata/orcl/control01.ctl

/ u01/app/oracle/oradata/orcl/control02.ctl

/ u01/app/oracle/control/control03.ctl

/ u01/app/oracle/control/control04.ctl

Tags: File data control database consistency parameter situation importance consistency two key content copy beginning method directory path generation difference success Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information vpn Docker Shulou Technology