DBLOG
» WTF
Toggle navigation
DBLOG
主页
OCM
1、概览
2、数据导入导出
3、GaussDB(DWS)数据库管理
4、数据库调优与开发实践
5、湖仓一体
6、开发应用
7、集群管理
8、巡检和维运维
About Me
归档
标签
S2
无
2025-03-12 09:19:08
10
0
0
admin
**DESCRIBE** external file store in '/home/oracle/files' 描述:外部文件存储在 '/home/oracle/files' **Database Name User/Password** - **PROD1**: sh/sh、hr/hr、oltp_user/oltp_user1、sys/oracle、system/oracle - **PROD2/PROD3**: sys/oracle、system/oracle - **PROD4**: sys/oracle、system/oracle、rc_admin/RC_ADMIN - **EMREP**: sys/Oracle123、system/Oracle123、sysman/Oracle123 **Tasks** 任务: **Section 1: Configure the Recovery Catalog** 部分1:配置恢复目录 - Connect to the recovery catalog created on the PROD4 database. The recovery catalog owner is rc_admin and password is RC_ADMIN. 连接到在 PROD4 数据库上创建的恢复目录。恢复目录拥有者为 rc_admin,密码为 RC_ADMIN。 1.1. Make sure that the recovery catalog is compatible with the Oracle Database 11g RMAN client on the Database Server machine. 确保恢复目录与数据库服务器机器上的 Oracle Database 11g RMAN 客户端兼容。 ``` export ORACLE_SID=PROD4 ``` 1.2. Register the PROD1 and PROD2 databases with the recovery catalog. 将 PROD1 和 PROD2 数据库注册到恢复目录中。 ``` # PROD1 export ORACLE_SID=PROD1 rman target / catalog rc_admin/RC_ADMIN@prod4 --启用备份优化。 CONFIGURE BACKUP OPTIMIZATION ON; --启用控制文件的自动备份。 CONFIGURE CONTROLFILE AUTOBACKUP ON; --配置备份设备类型为磁盘,并设置并行度为 2,同时指定备份类型为备份集(Backup Set)。 CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; # PROD2 export ORACLE_SID=PROD2 rman target / catalog rc_admin/RC_ADMIN@prod4 CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET; # PROD1 -- 注册数据库 REGISTER DATABASE; -- 如果报错,升级 catalog UPGRADE CATALOG; -- 再次注册数据库 REGISTER DATABASE; # PROD2 export ORACLE_SID=PROD2 rman target / catalog rc_admin/RC_ADMIN@prod4 -- 注册数据库 REGISTER DATABASE; ``` **Section 2: Backups** - Create backups of the PROD1 and PROD2 databases. All backups should be listed in the recovery catalog. 创建 PROD1 和 PROD2 数据库的备份。所有备份应在恢复目录中列出。 2.1. Back up the PROD2 database that can be used for recovery under any circumstances. Ensure that you have a complete set of files from which to recover if a media failure occurs. 备份 PROD2 数据库,以便在任何情况下都可以用于恢复。确保拥有完整的文件集以便在发生介质故障时进行恢复。 ``` export ORACLE_SID=PROD2 rman target / catalog rc_admin/RC_ADMIN@prod4 BACKUP DATABASE PLUS ARCHIVELOG; ``` 2.2. Create a long-term backup of the PROD1 database for archival purposes. Use tag Q107. 创建 PROD1 数据库的长期备份以用于存档目的。使用标签 Q107。 ``` BACKUP TAG 'Q107' FORMAT '/home/oracle/files/full_prod1.%U' DATABASE PLUS ARCHIVELOG KEEP FOREVER; ``` 2.3. The backup process of the EXAMPLE tablespace in the PROD1 database takes a long time. Perform the necessary configuration to speed up the backup process and reduce the size of the backup files. The size for each backup piece should not be greater than 30 MB. PROD1 数据库中 EXAMPLE 表空间的备份过程耗时较长。进行必要的配置以加快备份速度并减少备份文件大小。每个备份片的大小不应大于 30 MB。 ``` RUN { ALLOCATE CHANNEL c1 TYPE DISK; ALLOCATE CHANNEL c2 TYPE DISK; BACKUP AS COMPRESSED BACKUPSET SECTION SIZE 30M TABLESPACE example FORMAT '/home/oracle/files/example_prod1.%U'; } ``` 2.4. Reduce the overheads of fast incremental backups to a minimum on the PROD1 database. 将 PROD1 数据库快速增量备份的开销降至最低。 ``` ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/home/oracle/files/track.f'; ``` **Section 3: Configure Flashback** 部分3:配置闪回 3.1. Turn on Flashback Database for the PROD1 database. Configure a fast recovery area of 4GB. The fast recovery area should be in the /home/oracle/flash directory on the Database Server. 为 PROD1 数据库启用闪回数据库功能。配置一个大小为 4GB 的快速恢复区。快速恢复区应位于数据库服务器的 /home/oracle/flash 目录中。 ``` ALTER SYSTEM SET db_recovery_file_dest_size=4G; -- 如果之前已设置,此步可略 ALTER SYSTEM SET db_recovery_file_dest='/home/oracle/flash'; ALTER DATABASE FLASHBACK ON; ``` 3.2. In the PROD1 database, in the HR schema, the DEPARTMENT_ID column is the primary key of the DEPARTMENTS table. Execute a script (/home/oracle/scripts/s2_12.sql), flashback to step of before update operation. 在 PROD1 数据库中,HR 模式下的 DEPARTMENTS 表中的 DEPARTMENT_ID 列是主键。执行脚本 (/home/oracle/scripts/s2_12.sql),闪回到更新操作之前的步骤。 ``` SELECT current_scn FROM v$database; CREATE TABLE departments_bak AS SELECT * FROM departments; @/home/oracle/scripts/s2_12.sql ALTER TABLE departments ENABLE ROW MOVEMENT; FLASHBACK TABLE departments TO SCN 1258807; SELECT * FROM departments; ```
上一篇:
S1
下一篇:
S3
0
赞
10 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网