3.3. Create a window that utilites the DIALYREBUILD schedule and SYSTEM_PLAN resource manager plan.
targets-> database -> administration -> Oracle Scheduler -> Scheduler Windows -> Use an existing schedule ->HR. DAILYREBUILD -> ok
3.4. Create a job called REBUILD_JOB that uses the DAILYREBUILD schedule and EM_IND_REBUILD program.
targets-> database-> administration-> Oracle Scheduler -> Jobs -> create ->name REBUILD_JOB -> Command (change command type) EMP_IND_REBUILD
-> Schedule Schedule Type (Use Per-defined Schedule) DAILYREBUILD -> ok
至此,GC部分完成。
Section 3: 数据库备份恢复
1.Create an RMAN Catalog
1.1 Create a tablespace in your EMREP database called RC_DATA
1.1.1 Make it locally managed
1.1.2 Create it with one datafile of size 100MB Sqlplus sys/oracle@emrep as sysdba SQL>create tablespace RC_DATA Datafile ?/home/oracle/oradata/PROD/rc_data01.dbf? size 100M Autoextend on next 10M
Extent management local Segment space management auto;
1.2. Create a user named RC_ADMIN with password RC_ADMIN in your EMREP
1.2.1 The user must have a default tablespace of RAC_DATA 1.2.2 Give the user the ability to manage a Recovery Catalog Sqlplus sys/oracle@emrep as sysdba
SQL>create user RC_ADMIN identified by RC_ADMIN
default tablespace RC_ADMIN;
SQL>grant connect,resource,recovery_catalog_owner to RC_ADMIN; 1.3. Create a Recovery Catalog
1.3.1 Create the catalog in the EMREP database conned by RC_ADMIN Rman catalog RC_ADMIN/RC_ADMIN@emrep RMAN>create catalog tablespace RC_DATA; 1.3.2 Register the PROD database with the catalog
Rman target sys/oracle@prod catalog RC_ADMIN/RC_ADMIN@emrep RMAN>register database; RMAN> resync catalog;
2.Using RMAN
2.1. Configure RMAN options for the PROD database
2.1.1 Turn backup optimization on
RMAN>CONFIGURE BACKUP OPTIMIZATION ON;
2.1.2 Set your default channel to write to /home/oracle/backup (you may have to create this directory)
RMAN>CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT
?/home/oracle/bakup/%d_%T_%U.bak?;
2.1.3 Turn on controlfile autobackup to write to /home/oracle/backup/control (you may have to create this directory)
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
FOR DEVICE TYPE DISK TO '/home/oracle/backup/control/%F'
2.1.4 Configure a reteation window of 7 days
RMAN>CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; 2.2. Perform a backup
2.2.1 Perform a backup using your default channel,with compreesion 2.2.2 Include all datafiles in the backup
2.2.3 Include your current control file and spfile
2.2.4 Include all archive logs.then remove the originals RMAN>backup as compressed bakupset database include current controlfile plus archivelog delete all input;
3. Flashback Database
3.1. Turn on Flashback Database
3.1.1 Configure a flash recovery area of 4GB
3.1.2 Put your flash recovery area in /home/oracle/flash (you may have to create this directory)
SQL>alter system set db_recovery_file_dest_size=4G scope=both;
SQL>alter system set db_recovery_file_dest='/home/oracle/flash' scope=both; SQL>shutdown immediate; SQL>startup mount;
SQL>alter database flashback on; (SQL>alter database archivelog;) 3.2. your database open for review
SQL>alter database open;
至此,数据库备份恢复部分完成。
Section 4: 数据仓库管理
1. Fast Refreshable Materialized View
1.1 Using the query found in the mview1.txt text file.create a fast refreshable materialized view named PROD_MV in the SH schema.
SELECT time_id,prod_subcategory,SUM(unit_cost), COUNT(unit_cost),COUNT(*) FROM costs c,products p where c.prod_id=p.prod_id
GROUP BY time_id,prod_subcategory;
1.先创建表costs、products的 Materialized View Log