Preparing the Auxiliary Instance

本文详细介绍了如何在目标主机上安装Oracle数据库软件,创建辅助实例所需的初始化参数文件,以及设置密码文件。在不同主机间进行数据库迁移时,需要通过正常安装或克隆源Oracle家目原来完成软件安装,并确保块大小等参数匹配。同时,辅助实例的初始化参数文件必须包含DB_NAME和DB_DOMAIN等关键参数。此外,还讨论了建立辅助实例的密码文件和网络连通性的重要性,以及透明数据加密环境下目标主机对源数据库密钥库的访问需求。

(一)Installing the Oracle Database Software on the Destination Host

If the source and destination host are different, then you must install the Oracle Database software on the destination host so that the auxiliary instance can be created. You can install the software in one of the following ways:

  1. Perform a normal installation with Oracle Universal Installer (OUI).

Install an Oracle Database that is the same release as the source database. Do not create a database; install the software only. Apply any required patches.

  1. Clone the source Oracle home.

Use OUI to clone the source Oracle home. This ensures that all patches applied to the source database are present in the duplicate database.

(二)Creating an Initialization Parameter File for the Auxiliary Instance

An initialization parameter file is required to start the auxiliary instance. The initialization parameter file must contain at least the DB_NAME and DB_DOMAIN initialization parameters. Additional parameters may be specified if required. Setting DB_DOMAIN enables you to connect to the default database service when connecting with a net service name.

DB_NAME(Required)

The same name used in the DUPLICATE command. If you are using DUPLICATE to create a standby database, then the name must be the same as the primary database. The DB_NAME setting for the duplicate database must be unique among databases in its Oracle home.

DB_BLOCK_SIZE(Required if this initialization parameter is set in the source database)

The block size for the duplicate database. This block size must match the block size of the source database. If the source database parameter file contains a value for the DB_BLOCK_SIZE initialization parameter, then you must specify the same value for the auxiliary instance. If no DB_BLOCK_SIZE is specified in the source database initialization parameter file, however, then do not specify DB_BLOCK_SIZE in the auxiliary instance.

  1. Create an initialization parameter file manually
  1. Do one of the following:
  1. Copy the initialization parameter file from the source host to the destination host, placing it in the operating system-specific default location, and then modify DB_NAME and DB_DOMAIN. If you are duplicating a CDB, ensure that the ENABLE_PLUGGABLE_DATABASE parameter is present and set to TRUE.
  2. Complete these steps:

Using a text editor, create an empty file for use as a text-based initialization parameter file, and save it in the operating system-specific default location.

In the parameter file, set DB_NAME and DB_DOMAIN. These are the only required parameters.

If the auxiliary instance is to be a CDB, then set the following parameter:

ENABLE_PLUGGABLE_DATABASE=TRUE

  1. Set the various location parameters such as CONTROL_FILES and DB_RECOVERY_FILE_DEST.
  2. If necessary, set other initialization parameters like those needed for Oracle Real Application Clusters:
  3. Set the required environment variables, such as ORACLE_HOME and ORACLE_SID
  4. (Optional) Set initialization parameters that specify the location of the duplicate database files

CONTROL_FILES

DB_FILE_NAME_CONVERT

LOG_FILE_NAME_CONVERT

DB_CREATE_FILE_DEST

DB_CREATE_ONLINE_FILE_DEST_n

RECOVERY_FILE_DEST.

  1. Start SQL*Plus and connect to the auxiliary instance as a user with SYSDBA or SYSBACKUP privileges. Start the auxiliary instance in NOMOUNT mode. No PFILE parameter on the STARTUP command is necessary if the file is in the default location.

SQL> STARTUP NOMOUNT;

Example 25-1 Sample Initialization Parameter File for the Auxiliary Instance

DB_NAME=dupdb

CONTROL_FILES=(/dup/oracle/oradata/prod/control01.ctl,

                dup/oracle/oradata/prod/control02.ctl)

DB_FILE_NAME_CONVERT=(/oracle/oradata/prod/,/dup/oracle/oradata/prod/)

LOG_FILE_NAME_CONVERT=(/oracle/oradata/prod/redo,/dup/oracle/oradata/prod/redo)

  1. Copying the Server Parameter File from the Source Database

If the source database uses a server parameter file, then including the SPFILE clause in the DUPLICATE command directs RMAN to use the server parameter file from the source database for the auxiliary instance. For backup-based duplication, the server parameter file is restored from backups. For active database duplication, the server parameter file is copied from the source database to the auxiliary instance.

使用PARAMETER_VALUE_CONVERT SET 子句更改源库SPFILE参数

You can modify the values that were copied or restored from the server parameter file of the source database by using the PARAMETER_VALUE_CONVERT option of SPFILE or the SET clause of the DUPLICATE.

如果源库使用的是PFILE,虽然能在duplicate command中使用PFILE选项复制到auxiliary database,但不能更改参数要手动改

When the source database uses a text-based initialization parameter file, use the PFILE clause in the DUPLICATE command to copy the source database's initialization parameter file to the auxiliary instance.

(三)Creating a Password File for the Auxiliary Instance

Connections to the auxiliary instance can be established by using operating system authentication or password file authentication.

For backup-based duplication, you can either create a password file or use operating system authentication to connect to the auxiliary instance. For active database duplication, you must use password file authentication.

Setting up a password file is also mandatory when duplicating to a remote host.

Password files are always copied when you create a standby database using RMAN duplication.

In all other cases, password files are copied only if you specify PASSWORD FILE in the DUPLICATE command.

Use one of the following options to create a password file for the auxiliary instance on the destination host:

  1. Use operating system-specific utilities to copy the source database password file to the destination host and then rename it to match the auxiliary instance name. This is applicable only if the source and destination hosts are on the same platform.
  2. Create the password file manually. Ensure that the password for the SYSDBA and SYSBACKUP users are the same in the source database and auxiliary instance.
  3. Create the password file with the orapwd utility. The SYSBACKUP option creates a SYSBACKUP entry in the new password file.
  4. Specify the PASSWORD FILE option on the DUPLICATE... FROM ACTIVE DATABASE command.

RMAN copies the source database password file to the destination host and overwrites any existing password file for the auxiliary instance. This technique is useful if the source database password file has multiple passwords to make available on the duplicate database.

When using active database duplication, the password file must contain at least two passwords, for the SYS user and the SYSBACKUP user. These passwords must match the passwords in the source database.

  • Establishing Oracle Net Connectivity Between the Source Database and Auxiliary Instance

The auxiliary instance must be available through Oracle Net Services if any of the following conditions is true:

The RMAN client is run from a host other than the destination host

The duplication technique chosen is active database duplication

The destination host is different from the source host

To perform active database duplication, you must connect to the auxiliary instance with SYSDBA or SYSBACKUP privilege and by using a net service name.

The source database to which RMAN is connected as TARGET uses this net service name to connect directly to the auxiliary database instance.

Example 25-2 Example: Establishing Oracle Net Connectivity Between the Source Database and Auxiliary Instance

Assume that the DB_NAME of the source database is src the source host name is src.example.com. The DB_NAME of the auxiliary instance is dup and the auxiliary instance is created on the host dup.example.com.

Use the following steps to establish Oracle Net connectivity between the source database and the auxiliary instance:

  1. In the tnanames.ora file of the source database:

dupdb = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dup.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=dup)))

  1. On the destination host, create tnsnames.ora in the $ORACLE_HOME/admin/network folder

srcdb = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=src.example.com)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=src)))

  • Starting the Auxiliary Instance

Because the auxiliary instance does not yet have a control file, you can only start the instance in NOMOUNT mode.

  • Making the Oracle Keystore Available to the Destination Host

If transparent encryption is configured on the source database, then you must ensure that the Oracle software keystore from the source database is available to the auxiliary instance. The Oracle software keystore contains the TDE master key used to decrypt encrypted backups (for backup-based duplication) and database/tablespace data (for active database duplication of TDE-encrypted databases or tablespaces). Manually copy the source database keystore to the destination host.

The following are requirements for the keystore at the duplicate database:

  1. The keystore must be in the default location, or in the location indicated by the sqlnet.ora file.
  2. Permissions on the Oracle keystore file must be set so that the database can access the file.
  3. During duplication, the auxiliary instance is restarted thereby causing the Oracle software keystore to become unavailable. To ensure that the auxiliary instance has access to the keystore, set the ENCRYPTION_WALLET_LOCATION parameter in the sqlnet.ora file such that it points to the keystore location.
  4. With Oracle Real Application Clusters (Oracle RAC), register the auxiliary instance statically with an Oracle Grid Infrastructure listener and use the ENVS parameter in thesqlnet.ora file of the Oracle Grid home to specify environment variables that set the keystore location and the unique name of the database.

The following example sets the ENVS parameter in sqlnet.ora to specify the keystore location and unique database name:

(ENVS="ORACLE_UNQNAME=cdbrptl, ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/etc/ORACLE/WALLETS/cdbrpt1)))")

  1. If the source database uses a password-based software keystore (not an auto-login software keystore), then you must provide the keystore password before you begin the duplication.

Use the SET command with the DECRYPTION WALLET OPEN IDENTIFIED BY clause to specify the password that must be used to open the keystore.

The following command specifies the password used to open the keystore (where password is a placeholder for the actual password that you enter):

SET DECRYPTION WALLET OPEN IDENTIFIED BY password;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值