Preparing the Auxiliary Instance

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(一)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;

<think>好的,用户遇到了MySQL安装过程中出现“Preparing”错误的问题,我需要详细分析可能的原因和解决方法。首先,用户可能是在Windows环境下安装MySQL,因为这类问题在Windows中较为常见。常见的安装错误可能包括权限不足、依赖项缺失、之前的安装残留、安装包损坏或与现有软件冲突。 首先,权限问题。安装MySQL通常需要管理员权限,如果用户没有以管理员身份运行安装程序,可能导致无法写入系统文件或注册表,从而卡在Preparing阶段。我应该提醒用户右键点击安装程序,选择“以管理员身份运行”。 接下来,检查系统依赖项。特别是Microsoft Visual C++ Redistributable包,MySQL依赖这些运行库。如果用户系统缺少对应的版本,安装程序可能在准备阶段失败。建议用户前往微软官网下载并安装最新的VC++运行库。 然后,清理之前的安装残留。如果用户之前安装过MySQL但未彻底卸载,残留的文件或注册表项可能导致冲突。需要指导用户使用控制面板卸载程序,并手动删除MySQL的安装目录(如C:\Program Files\MySQL和C:\Program Files (x86)\MySQL)以及数据目录(默认是C:\ProgramData\MySQL,注意ProgramData是隐藏文件夹)。此外,注册表清理可能需要谨慎操作,建议使用专业工具或详细步骤,避免误删系统关键项。 安装包完整性也是一个可能因素。下载过程中网络中断或文件损坏会导致安装程序无法继续。建议用户重新下载安装包,验证哈希值是否匹配官方提供的数据,确保文件完整。 安全软件冲突方面,某些杀毒软件或防火墙可能会错误地拦截安装进程,导致卡住。可以建议用户暂时禁用安全软件,或在安装过程中添加例外。 兼容性问题,尤其是在较新的Windows版本上,可能需要以兼容模式运行安装程序。例如,右键安装程序属性中设置兼容模式为旧版Windows,并勾选“以管理员运行”。 如果以上步骤无效,可能需要查看安装日志。日志通常位于C:\ProgramData\MySQL\InstallationLog.txt,分析具体错误信息能更精准定位问题。例如,日志中提到的特定错误代码或缺失文件。 此外,用户可能尝试过其他方法未果,需要更深入的解决方案,如手动安装或使用命令行工具。例如,使用MySQL的MSI安装包结合命令行参数进行静默安装,可能绕过图形界面中的某些问题。 最后,如果所有方法都失败,建议用户到MySQL官方社区或论坛寻求帮助,提供详细的错误日志,以便更专业的支持。同时,确保用户的操作系统更新到最新版本,安装所有系统补丁,可能解决潜在的兼容性问题。 总结,解决步骤应分点列出,从简单到复杂,用户容易操作的建议优先,如权限、依赖项、清理残留等,逐步深入。需要避免使用过于技术化的术语,保持语言简洁明了,确保用户能理解并执行。同时提醒用户操作注册表的风险,建议备份或使用可靠工具,避免系统损坏。</think>MySQL安装过程中遇到"Preparing"阶段的错误通常由以下原因引起,可按以下步骤排查解决: --- ### **1. 权限不足** - 🔍 **表现**:安装程序无法写入系统目录或注册表 - ✅ **解决方案**: - 右键点击安装程序 → 选择「以管理员身份运行」 - 关闭所有杀毒软件(可能误拦截) --- ### **2. 系统依赖缺失** - 🔍 **关键依赖**:Microsoft Visual C++ Redistributable - ✅ **解决方案**: 1. 前往微软官网下载: - [Visual C++ 2015-2022 Redistributable](https://aka.ms/vs/17/release/vc_redist.x64.exe) 2. 安装后重启电脑 3. 重新运行MySQL安装程序 --- ### **3. 旧版本残留** - 🔍 **常见残留位置**: - 安装目录:`C:\Program Files\MySQL` - 数据目录:`C:\ProgramData\MySQL`(隐藏文件夹) - 注册表:`HKEY_LOCAL_MACHINE\SOFTWARE\MySQL` - ✅ **清理步骤**: 1. 控制面板 → 卸载旧版MySQL 2. 手动删除上述目录 3. 使用工具清理注册表(如CCleaner) --- ### **4. 安装包损坏** - ✅ **验证方法**: 1. 重新下载官方安装包 2. 对比SHA256校验值(官网提供) 3. 使用迅雷等工具确保完整下载 --- ### **5. 端口/服务冲突** - 🔍 **检查项**: - 默认端口3306是否被占用(cmd运行 `netstat -ano | findstr :3306`) - 服务中是否存在残留的`MySQL`服务(services.msc) - ✅ **解决**: - 终止占用进程 - 删除残留服务:`sc delete MySQL` --- ### **6. 日志定位问题** - 📍 **日志路径**: - `C:\ProgramData\MySQL\InstallationLog.txt` - 🔑 **关键操作**: - 搜索日志中的`ERROR`关键词 - 根据具体错误代码针对性解决 --- ### **高级解决方案** - **方法1**:使用命令行静默安装 ```bash msiexec /i mysql-installer-community-8.0.xx.msi /quiet ``` - **方法2**:手动安装核心组件 1. 单独下载MySQL Server MSI包 2. 先安装`MySQL Server`,再安装其他工具 --- ### **附:典型错误案例** - ❌ **错误示例**: `Error 1918: Failed to install ODBC driver` - ✅ **修复步骤**: 1. 控制面板 → 卸载所有`MySQL ODBC`驱动 2. 下载最新ODBC驱动:[MySQL Connector/ODBC](https://dev.mysql.com/downloads/connector/odbc/) 3. 单独安装驱动后再重试 --- 如果问题仍未解决,建议: 1. 截图错误界面 2. 上传安装日志文件 3. 到[MySQL官方论坛](https://forums.mysql.com/)提问 (可附上日志内容获取更精准帮助)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值