在开始之前,最好先查看 Backup and DR for Oracle。
在备份 Oracle 数据库之前,您必须将 Oracle 服务器作为主机添加到 Backup and DR。为此,请务必参阅备份 Oracle 数据库的前提条件,然后按照以下准备步骤操作。
在 Linux 环境中准备 Oracle 数据库
在保护 Oracle 数据库之前,或者在数据库保护作业失败时,请确保 Oracle 数据库服务器上的以下设置正确无误。
- 要保护的每个 Oracle 数据库都必须处于正常运行状态。例如:
database: actdb
ps -ef | grep pmon | grep -i actdb
oracle 27688 1 0 2015 ? 00:26:24 ora_pmon_actdb
- 数据库必须以归档日志模式运行。如需验证数据库是否以归档日志模式运行,请以 Oracle 操作系统用户身份登录数据库服务器,并设置数据库环境变量:
export ORACLE_HOME=<oracle home path>
# Get this from /etc/oratab
export ORACLE_SID=<database instance name>
export PATH=$ORACLE_HOME/bin:$PATH
Login to sqlplus:
sqlplus / as sysdba
archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 569
Next log sequence to archive 570
Current log sequence 570
Note: If archive log mode is not enabled then get archive mode enabled
before proceeding.
- 数据库应使用
spfile。验证数据库是否正在运行,且运行的是spfile:
sqlplus / as sysdba
show parameter spfile
NAME TYPE VALUE
------------------ ----------- ------------
spfile string +DATA/ctdb/spfilectdb.ora
Note: If the value is `null_` then
get the spfile set. Backup and DR supports backing up using pfile as well.
pfile should be available in default location. For example, a
Linux `pfile` should be located under `$ORACLE_HOME/dbs`.
对于 Oracle RAC 数据库,快照控制文件必须位于共享磁盘下。对于 ASM 下的 Oracle RAC 数据库,快照控制文件必须位于共享磁盘下。
如需检查这一点,请连接到 RMAN 并运行
show all命令。如有必要,请进行配置:rman target /然后在 RMAN 中:
show all对于 db_unique_name 为 CTDB 的数据库,RMAN 配置参数如下:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/mnt/ctdb/snapcf_ctdb.f';
This example shows the configuration set to the local file system.
In a RAC environment, this must be set to shared ASM Disk Group. To put it
on the ASM Disk Group, use:
```bash
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+(disk group name)/snap_(database name).f';
```
准备备份数据文件位于 ASM 磁盘组中的 Oracle 数据库
ASM 磁盘组上的 Backup and DR 暂存磁盘
必须设置 ASM diskstring 参数,且该参数不得为 null。以 ASM 操作系统用户身份登录到数据库服务器,并设置 ASM 环境变量:
export ORACLE_HOME=(oracle ASM home path)
# Get this from /etc/oratab
export ORACLE_SID=(ASM instance name)
export PATH=$ORACLE_HOME/bin:$PATH
连接到 sqlplus:
sqlplus / as sysasm
show parameter asm_diskstring
NAME TYPE VALUE
------------------- ----------- ------------------------------
asm_diskstring string ORCL:*, /dev/sdt1, /dev/sdu1
如果价值的结果为 null,则在继续进行 Backup and DR 保护之前,获取现有 ASM 磁盘的正确 ASM 磁盘字符串值。Backup and DR 备份会添加其备份暂存磁盘的磁盘字符串路径 (/dev/Backup and DR/asm/*),以映射到 ASM。
文件系统上的 Backup and DR 暂存磁盘
如果您要将 Oracle ASM 数据库保护到文件系统,则必须在应用详细信息和设置下将将 ASM 转换为文件系统设置为是。 请参阅Oracle 数据库的应用详细信息和设置。