求助,v$求easvrecovery激活码y

从这一章, 到最后一章都是讲 RMAN
Rman is an Oracle utility that helps you manage the backup, restore, and recovery oerations on Oracle database.
Rman has a powerful command language that is independent of the operating system.
Oracle Enterprise Manager also provides a graphical user interface for the Recovery Manager.
对比之后, rman 比手工好的地方在于 : ( 手工只能冷备, 是在操作系统上copy, paste )
1. You can store frequently executed opeartions as scripts in the database.
2. Using the incremental block-level backup feature you can limit the backup size to only those blocks that have changed since the previous backup. This also helops to reduce the time it takes to perform recovery operations in Archivelog mode.
3. You can use RMAN to manage the size of backup pieces and save time by parallelizing the backup operation. ( 热备 )
4. RMAN operations can be integrated with the scheluling of the operating system to automate backup operations.
&&& ( 可以配合操作系统的任务来执行 RMAN )
手工备份的主要方法就是(冷备) : 关闭数据库-& copy 想要备份的文件 -& 打开数据库. ( 如果数据库出现问题, 可以首先还原完整备份, 即冷备的时刻, 然后再使用Archivelog 文档把剩下的内容恢复 ) (我们系统目前使用的是这种方式)
RMAN 是备份主流,是标准的备份策略, 但是万一 RMAN 不行了, 我们还可以使用手工备份。
restore: 还原(说白了就是操作系统级别的 copy, paste)
recovery: 恢复
以上两个是不一样的, SCN 类似 oracle 中的心跳, 时间刻度, 永远向上递增.
系统坏了, 想弄好, 那么需要两步, 首先是 restore, 然后是 recovery ( 利用 archived redo logs 自动)
You can store frequently executed operations as scripts in the database.
You can use RMAN to manage the size of backup pieces and save time by parallelizing the backup operation.
You can detect block corruption. The information relating to the block corruption that is detected during bakcup can be obtained by using the dynamic views V$ABCKUP_CORRUPTION and V$COPY_CORRUPTION.
RMAN provides performance enhancements such as :
Automatic parallelization of backup, restore, and recovery operations
No generation of extra redo during online database backups
Backups that are restricted to limit reads per file, per second to avoid interfering with OLTP work
RMAN has a media management API to work seamlessly with third-party media management tools interfacing with storage devices providing increased speed and reliability.
Recovery Manager Executable : RMAN 解释用户输入命令,并且 适当的调用 server session 来完成任务.
The Recovery Manager command-line interface is invoked through the executable RMAN. RMAN interprets user commands and appropriately invokes server sessions to perform the desired tasks.
Sever Sessions : 是真正干活的, 可能应该是进程
The server processes(Unix) or services(Windows NT) invoked by RMAN connect to the target database to perform the backup, restore, adn recovery function through a PL/SQL interface.
Target database : 你想要备份的数据库
The database for which backup and recovery operations are being performed using RMAN is called the target database. The control file of the target database contains information about its physical structure, such as the size and location of datafiles, online and archived redo log files, and control files. This information is used by the server sessions invoked by RMAN in backup and recovery operations.
RMAN Repository : The data used by RMAN for backup, restore, recovery operations is reffered to as RMAN metadata. It is stored in the control file of the target database and in an optional recovery catalog database. Although it is not mandatory to create a recovery catalog to use RMAN, it is beneficial to use a recovery catalog. The recovery catalog should be located in a database different from the target database.
RMAN 需要存储很多很重要的信息(关于 target database, backup , recovery 等信息, The target control file can be used as the exclusive storage location for this information. 也就是说, 目标数据库的 control file 可以用来存储这些重要的信息 )
Channel : 就是需要一个连接, 来连接 target 数据库, 这样才能备份target数据库, 类似ODBC一样。
Media Management Library : 存储介质制造商提供的驱动, 比如你要存储在磁带上,那么就需要磁带的驱动。
rman 不是 sqlplus 中的命令,是在linux系统下的命令, 例如
rman target sys/oracle nocatalog ( 如果是远程执行 rman target
nocatalog )
target database : 你要备份的数据库
一些重要信息和脚本 : 可以存储在 target database 的 control file 或者 recovery catalog DB
rman target
rman 只要连接上来, 就会直接有两个 server process , 一个是 polling , 一个是 server session(default)
RMAN 是一个命令行工具
RMAN stores information about the target databsae and its backup and recovery operations in the RMAN repository. The target database control file can be used as the exclusive storage location for this information. The amount of information stored can increase depending on the frequency of backups, the number of archived redo log files that are generated, and the retention period for RMAN records.
CONTROL_FILE_RECORD_KEEP_TIME: 这个参数是天数, 就是多少天,这个backup信息被覆盖, 默认是 7 天, 但是如果你选择不使用 control file来存储, 而使用 recovery catalog ,那么这个数值应该 小一点.
The control file cannot be used to store RMAN scripts. ( 可以用来存储重要信息 )
RMAN 在客户端执行
channel : 就是一个连接
A channel represents one stream of data to a device type. A channel must be allocated before you execute backup and recovery commands.
Each allocated channel establishes a connection from the RMAN executable to a target or auxiliary database instance by starting a server session on the instances. This server session performs the backup and recovery operations. Only one RMAN session communicates with the allocated server sessions.
Each channel usually corresponds to one output device, unless your MML is capable of hardware multiplexing.
Manual channel allocation overrides automatic allocation. ( ALLOCATE CHANNEL FOR MAINTENANCE )
默认的是备份到 disk, RMAN provides a preconfigured DISK channel that you can use for backups and copies to disk.
In addition, you can configure a set of persistent, automatic channels. You specify automatic channels to disk or tape by using the CONFIGURE CHANNEL command.
You can save persistent configuration information such as channel parameters, parallelism, and the default device type in the RMAN repository. You can configure automatic channels for use in backup, restore, recovery, and maintenance jobs.
When a channel is automatically allocated by RMAN, its name is in the format ora_devicetype_n (ora_sbt_tape_n or ora_disk_n)
You can override automatic channels by using the ALLOCATE CHANNEL command to allocate channels manually. The automatic channel feature is mutually exclusive with the mannual channel feature: RMAN uses one or the other for every job.
By default, RMAN has preconfigured a disk channel so that you can backup to disk without doing any manual configuration, Hence, if you are backing up to disk rather than to a media manager, you can immediately begin backing up to disk.
RMAN : 连接上以后可以通过 show all 显示配置信息
RMAN uses the channel processes to communicate between the Oracle server and the operating system.
The type of media desired determines the type of channel allocated. Query the V$BACKUP_DEVICE view to determine supported device types.(我目前系统只支持 tape? 不是, 这个 tape 在这里不是磁带的意思)
media management library : 类似驱动程序,& 通过这个 oracle 可以找到 存储介质厂商提供的存储介质.
Before you can begin using RMAN with a media manager, you must install it and make sure that RMAN can communicate with it. Instructions for this procedure should be available in the media manager vendor&s software documentation.
target database : You& must have SYSDBA privilege for the connection to succeed.
Recovery catalog database : This is an optional database which is configured for the RMAN repository.
Auxiliary database: 辅助数据库, An anxiliary database is a database created using the RMAN DUPLICATE command. ( 全部复制 target 到 duplicate database 等等的时候使用, 不是很常用 )
rman target sys/oracle nocatalog ( 系统中会创建三个进程, 一个是 rman target , 另外两个是 rman target 的子进程, server process(polling), server process(default) )
3 个进程分别是 :
A user process is created for Recovery Manager ( RMAN, 父进程 )
2 个 server processes:
- one default process connected to the target database for executing SQL command, 恢复control file 等
- one polling process connected to the target database to locate Remote Procedure Call(RPC) completions.
另外执行以上 rman 命令以后, 还有就是 backup and recovery information is retrieved from the control file.
在运行脚本时使用 log 如果有错误, 可以看到错误信息.
RMAN 和 SQLPLUS 一样,可以执行交互式命令。
人机交互模式
流入, rman target , 进入 RMAN, 输入 BACKUP DATABASE;
一般用于分析啊, 什么的.
脚本批处理模式
你可以将命令写到一个脚本中, 然后运行该脚本.
When running in batch mode, RMAN reads input from a command file and writes output messages to a log file(if specified)
一般用于周期性备份工作
rman target
nocatalog &&!
其中 && 这个符号后边是分隔符 即 ! 前后的 ! 是成对出现
脚本这种批处理技术, 是非常好用的.
交互和批处理 两种模式 ( 跟pl/sql 一样 )
批处理模式
RMAN parses the command file in its entirety before compiling or executing any commands. There is no need to place an exit command in the file because RMAN will terminate when the end of the file is reached.
Batch mode is most suitable for performing regularly scheduled backups by means of an operating system job-control facility.
例如: rman target sys/oracle tbsbk.rcv log tbs.log
其中: tbsbk.rcv 就是 已经写好的脚本文件,要执行的
&&&&&&& log tbs.log 是执行的结果情况的保存文件 output the message
job : 要么都执行, 要么都不执行, 一致性
RMAN 的命令要用 ; 号分割开
show all 最好用, 因为内容少, 直接一个 show all 全都看了
report schema'; 查看 target database 表空间情况
This command helps you analyze information in the RMAN repository in more detail.
rman 是需要 pl/sql 包来支持的, 所以要安装这些包
DBMS_RCVCAT and DBMS_RCVMAN (包)
安装包的文件: dbmsrman.sql and catproc.sql
DBMS_BACKUP_RESOTRE (包)
catproc.sql
一、Recovery Manager(RMAN)特性
&&& 是一种用于集备份(backup)、还原(restore)和恢复(recover)数据库于一体的Oracle 工具,支持命令行及图形界面操作
&&& 能够备份整个数据库、表空间、数据文件、控制文件、归档文件以及Spfile参数文件。
&&& 支持增量数据块级别的备份和块级别的介质恢复
&&& 可以保存频繁执行的备份恢复脚本
&&& 可以实现数据库的克隆、使用RMAN建立备用数据库
&&& 支持镜像备份与备份集,可以备份到磁盘与磁带
&&& 管理备份与恢复任务
&&& 可增加备份并发度或限制I/O减少备份给数据库带来的影响
&&& 在备份期间检查损坏的数据块
&&& 支持在备份期间使用压缩特性来减少磁盘空间的占用
二、RMAN组件
&&& 1.RMAN可执行程序
&&&&&&&& 在Windows操作系统中为rman.exe,在Unix系统中为rman
&&&&&&&& 程序所在位置:$ORACLE_HOME/bin
&&&&&&&& a.进程与内存要求
&&&&&&&&&&&& 更多的进程的需要
&&&&&&&&&&&& 大池的分配
&&&&&&&& b.基本环境变量需求
&&&&&&&&&&&& ORACLE_SID,ORACLE_HOME,PATH,NLS_LANG,对基于时间的备份与恢复,需要另外设置NLS_DATE_FORMAT
&&&&&&&& c.权限要求
&&&&&&&&&&&&& 需要sysdba系统权限
&&&&&&&&&&&& 如果是本地,也可以采用OS认证,远程需要采用密码文件认证
&&&&&&&& d.版本要求
&&&&&&&&&&&& RMAN工具版本与目标数据库必须是同一个版本。如使用恢复目录 还需要注意
&&&&&&&&&&&& 创建rman恢复目录的脚本版本必须大于或等于恢复目录所在数据库的版本
&&&&&&&&&&&& 创建rman恢复目录的脚本版本必须大于或等于目标数据库版本
&&&&&&&&& e.注意Linux中有两个RMAN
&&&&&&&&&&&&&&& [root@robinson ~]# find / -name rman
&&&&&&&&&&&&&&& /usr/X11R6/bin/rman #--非oracle的rman命令
&&&&&&&&&&&&&& /u01/app/oracle/10g/oc4j/j2ee/oc4j_applications/applications/em/em/database/rman
&&&&&&&&&&&&&& /u01/app/oracle/10g/oc4j/j2ee/oc4j_applications/applications/em/em/WEB-INF/perl/db/rman
&&&&&&&&&&&&&& /u01/app/oracle/10g/bin/rman #--oracle中的rman命令
&&&&&&&&&&&&&& /u01/app/oracle/10g/sysman/admin/scripts/db/rman
&&&&&&&&&&&&&& 根据变量PATH的设置,哪个在前,则优先使用在前面的命令
&&&&&&&&&&&&&& 解决办法:修改PATH变量,即将.bash_profile文件PATH项中$ORACLE_HOME/bin放在$PATH之前
&&&&&&&&&&&&&& [oracle@robinson ~]$ echo $PATH #--修改前
&&&&&&&&&&&&&& /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/u01/app/oracle/10g/bin
&&&&&&&&&&&&&& [oracle@robinson ~]$ echo $PATH #--修改后
&&&&&&&&&&&&&& /u01/app/oracle/10g/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
&&&&&&&&&&&&&& 这个的确是, 自己也碰到过
&&& 2.目标数据库
&&&&&&&& 目标数据库即指想要备份、还原与恢复的数据库。RMAN可执行程序一次只能连接一个数据库
&&&&&&&& 目标数据库的控制文件存储了RMAN所需的信息(存储仓库使用控制文件时),RMAN通过读取控制文件来确定目标数据库的物理结构,
&&&&&&&& 要备份的数据文件的位置,归档信息等,在使用RMAN时会对控制文件进行更新。
&&& 3.服务器进程与通道
&&&&&&&& RMAN可从从远程或本地通过普通的服务器会话与调用PL/SQL连接到实例,RMAN启动后会产生一个普通的服务器进程
&&&&&&&& 一旦备份与还原操作启动,则RMAN会根据配置启用一个或多个通道
&&&&&&&& 通道简言之即是完成文件复制工作的的服务器进程,多通道则实现了并行执行操作
&&&&&&&& 通道分为备份或还原到磁盘的磁盘通道(disk channel)、备份还原到磁带的磁带通道(SBT),可以自动或手动分配通道
&&& 4.存储仓库
&&&&&&& 存储了与目标数据库及其备份相关的元数据
&&&&&&& 包含目标数据库物理结构的详细信息、数据文件的位置
&&&&&&& 已完成的所有备份的细节
&&&&&&& RMAN的永久配置信息
&&&&&&& 存储仓库始终被存储在目标数据库的控制文件内,或存储在恢复目录内(一个单独的Oracle数据库)
&&&&&&& 参数control_file_record_keep_time决定了控制文件里可重复使用的记录所能保存的最小天数
&&&&&&& 当一条新的记录需要添加到可重用记录的空间时,并且最老的记录在可重用记录空间中还没有老化,即实际保留的天数未超过
&&&&&&& 这个参数规定的天数,则控制文件中可重用记录部分的空间将被自动扩展,此时控制文件尺寸将会变大。
&&& 5.恢复目录
&&&&&&& 可以将目标数据库的备份恢复,元数据等相关信息写入到一个单独的数据库,这个单独的数据库即为恢复目录
&&&&&&& 恢复目录可以存储RMAN脚本,而非恢复目录情况下,则备份恢复脚本存储为操作系统文件
&&&&&&& 恢复目录的内容通常包括,数据文件、归档日志备份集,备份片,镜像副本、RMAN存储脚本,永久久的配置信息等
&&&&&&& 建议将恢复目录放置到与目标数据库不同的主机之上
&&& 6.支持介质管理库
&&&&&&& 介质管理库用于RMAN从磁带进行备份与还原
&&&&&&& RMAN支持主流的磁带库设备与软件(IBM,Hewlett Packard)
&&& 7.辅助数据库(Standby Database $ duplicate database)
&&&&&&& Standby Database:是目标数据库的一个副本,使用目标数据库(主数据库)archived log将其更新,不具有唯一的DBID
&&&&&&& rman 可以创建或备份Standby Database,可用于主数据库的故障转移
&&&&&&& duplicate database:是目标数据库的一个副本或子集,且拥有唯一的DBID,从而独立于主数据库
&&&&&&& 能够在相同的恢复目录内作为一个主数据库注册,通常用于测试目的
&&&&&&& TSPITR(tablespace point-in-time recovery):表空间时点恢复,将一个或多个表空间恢复到非当前状态,而其它表空间保留当前状态
&&& 8.备份目的地
&&&&&&& 默认的备份目的地为闪回区,$ORACLE_BASE/flash_recovery_area/
&&&&&&& 可以设置参数DB_RECOVERY_FILE_DEST参数和DB_RECOVERY_FILE_SIZE进行调整
&&& 9.通道与通道分配,请参考:RMAN 配置、监控与管理
三、使用RMAN连接到数据库
&&& --不连接数据库仅启动rman
&&&&&&& [oracle@oradb ~]$ rman
&&& --使用操作系统认证连接到目标数据库
&&&&&&& Unix: $ ORACLE_SID = export ORACLE_SID
&&&&&&& $ rman target /
--从命令行连接到目标数据库和恢复目录
% rman target / catalog rman/cat@catdb --使用OS认证,第二个rman为恢复目录的schema
% rman target sys/oracle@trgt catalog rman/cat@catdb --使用Oracle Net 认证
--从rman提示符连接到目标数据库和恢复目录
RMAN& connect target / --使用OS认证
RMAN& connect catalog rman/cat@catdb
RMAN& connect target sys/oracle@trgt --使用Oracle Net 认证
RMAN& connect catalog rman/cat@catdb
--命令行连接到辅助数据库
% rman auxiliary sys/aux@auxdb
% rman target sys/oracle@trgt auxiliary sys/aux@auxdb catalog rman/cat@catdb
--从rman提示符连接辅助数据库
RMAN& connect auxiliary sys/aux@auxdb
RMAN& connect target sys/oracle@trgt
RMAN& connect catalog rman/cat@catdb
RMAN& connect auxiliary sys/aux@auxdb
rman target sys/oracle@trgt
rman target / nocatalog 等同于rman target /
四、RMAN命令
&&&& RMAN 命令分类
&&&& 单命令
&&&&&&& 仅仅在RMAN提示符下执行
&&&&&&& 单独被执行
&&&&&&& 不能够作为RUN的子命令
&&&&&&& 如backup database
&&&&&&& 下列命令不能用作批命令来使用
&&&&&&& CONNECT
&&&&&&& CONFIGURE
&&&&&&& CREATE CATALOG, DROP CATALOG, UPGRADE CATALOG
&&&&&&& CREATE SCRIPT, DELETE SCRIPT, REPLACE SCRIPT
&&&&&&& LIST
&&&&&&& REPORT
&&&& 批命令
&&&&&&&& 在RUN命令中用括号括起来使用,常用的批命令为allocate channel,set newname for datafile,release channel,switch,set等
&&&&&&&& 作为一个组被执行
&&&&&&&& 如:
&&&&&&&& RMAN& RUN {
&&&&&&&&&&&&&& 2& backup incremental level 0
&&&&&&&&&&&&&& 3& format '/u01/app/oracle/bak/%d_%s_%p'
&&&&&&&&&&&&&& 4& fileperset 5(database include current controlfile);
&&&&&&&&&&&&&& 5& sql 'alter databaes archive log current ';}
&&&& 混合的独立和作业命令
阅读(...) 评论()Oracle 学习笔记: Backup & Recovery 常用命令 - 唯偏执狂才能生存 - ITeye技术网站
博客分类:
. set database to archivelog mode
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Total System Global Area
Fixed Size
1248356 bytes
Variable Size
Database Buffers
Redo Buffers
7139328 bytes
Database mounted.
SQL& alter
Database altered.
Database altered.
Database log mode
Archive Mode
Automatic archival
Archive destination
USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
Next log sequence to archive
Current log sequence
. define flash recovery area
SQL& alter system set db_recovery_file_dest='D:\oracle\flash_recovery_area' scope=
System altered.
SQL& alter system set db_recovery_file_dest_size=15G scope=
System altered.
Oracle will use Oracle Managed File (OMF) for the flash recovery area. The free space in recovery area can be checked using OEM: All Metrics -& Recovery Area, or query vflash_recovery_area_usage view. To get more free space, you can use the following command to backup and then delete all the archived log files.
RMAN& backup archivelog
. define multiple archived log destinations
SQL& alter system set log_archive_dest_1='location=use_db_recovery_file_dest' scope=
System altered.
SQL& alter system set log_archive_dest_2='location=D:\oracle\archivelog_area1' scope=
System altered.
. CONTROL_FILE_RECORD_KEEP_TIME
This parameter specify the minimum days the RMAN information is stored in the control file before overwritten. The default value is 7 days. When using catalog, a smaller value should be chosen.
. starting RMAN
rman target /
rman target / nocatalog
rman target sys/change_on_install@orcl
rman target sys/change_on_install@orcl catalog rman/rman@catdb
rman target sys/change_on_install log=xxx.log append
rman target sys/change_on_install cmdfile=xxx.rcv
. RMAN persistent settings
6.1 display settings
RMAN& show co
6.2 configure settings
RMAN& configure retention policy to recovery window of 7
RMAN& configure ba
RMAN& configure default
RMAN& configure contr
RMAN& configure controlfile autobackup format for device type disk to '%F';
RMAN& configure device type disk backup type to compressed backupset parallelism 1;
RMAN& configure datafile backup copies for device type disk to 1;
RMAN& configure archivelog backup copies for device type disk to 1;
RMAN& configure channel device type disk maxpiecesize 1 G;
RMAN& configure max
RMAN& configure encrypt
RMAN& configure encryption algorithm 'AES128';
RMAN& configure archivelog del
RMAN& configure snapshot controlfile name to 'D:\oracle\flash_recovery_area\sncfepcit.ora';
If the control file autobackup is enabled, then RMAN automatically backs up the control file and spfile in one of two circumstances:
- A successful backup is recorded in the RMAN repository
- A structural change to the database affects the contents of the control file
Control file autobackups are stored in the flash recovery area, unless otherwise specified.
6.3 reset settings to default value
RMAN& configure controlf
RMAN& configure re
7. RMAN commands
7.1 backup commands
RMAN& backup as compresse
RMAN& backup as backupset format ''/BACKUP/df_%d_%s_%p.bus'
RMAN& backup database plus archive
RMAN& backup archivelog from sequence=234
RMAN& backup tag='month_full_backup' datafile 1, 2, 3, 4;
RMAN& backup incremental level 0
RMAN& backup incremental level 1
RMAN& backup incremental level 1
RMAN& run {
2& allocate channel c1
3& allocate channel c2
4& allocate channel c3
5& backup incremental level = 0
6& format '/disk1/backup/df_%d_%s_%p.bak'
7& (datafile 1,4,5 channel c1)
8& (datafile 2,3,9 channel c2)
9& (datafile 6,7,8 channel c3);
10& alter system
7.2 block change tracking
SQL& alter database enable block change tracking using file ''/mydir/rman_change_track.f'
SQL& alter database disable b
7.3 incrementally updating backups
RMAN& backup as copy incremental level 0 datafile 1 tag 'basecopy';
RMAN& backup incremental level 1 for recover of copy with tag 'basecopy' datafile 1;
RMAN& recover copy of datafile 1 with tag 'basecopy';
7.4 list commands
RMAN& list backup
RMAN& list backup of table
RMAN& list backup of datafile {n|'file_name'}
RMAN& list backup of database by {file|backup};
7.5 report commands
RMAN& report need backup incremental 0
RMAN& report need backup days 3;
RMAN& report need backup redundancy 2;
RMAN& report need backup recovery window of 3
RMAN& report obsolete redundancy 2;
RMAN& report obsolete recovery window of 3
7.6 delete commands
RMAN& delete n
RMAN& delete nop
RMAN& dele
RMAN& delete obsolete redundancy 2;
RMAN& delete obsolete recovery window of 3
RMAN& delete backupset 4;
8. RMAN v$ views
V$ARCHIVED_LOG
V$BACKUP_CORRUPTION
V$BACKUP_DEVICE
V$BACKUP_FILES
V$BACKUP_PIECE
V$BACKUP_REDOLOG
V$BACKUP_SET
V$BACKUP_SPFILE
V$COPY_CORRUPTION
V$RMAN_CONFIGURATION
论坛回复 /
(0 / 4513)
浏览: 64563 次
来自: 新力吐皮
好,不错啊
thank you!~!
技术就是可以给老板挣钱,可以造福他人,可以被其他人所用,却可以 ...
现在的现实是真正懂js,css,html的开发人员太少了,我见 ...
开发出来了 是否开源 一下下}

我要回帖

更多关于 g9008v recovery 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信