官方文档 恢复备份指南四 Starting and Interacting with the RMAN Client
本章讲:
- Starting and Exiting RMAN
- Specifying the Location of RMAN Output 指定RMAN输出位置
- Setting Globalization Support Environment Variables for RMAN 设置RMAN全局变量
- Entering RMAN Commands 进入RMAN命令
- Making Database Connections with RMAN 用RMAN连接数据库
- Using the RMAN Pipe Interface 使用RMAN 管道接口
% rman 进入后再输入用户名密码
% rman TARGET / # operating system authentication 操作系统验证,即在数据库服务器上使用RMAN
% rman TARGET SYS@prod NOCATALOG # RMAN prompts for SYS password 使用SYS用户登录RMAN
% rman TARGET / CATALOG rco@catdb # RMAN prompts for rco password 在数据库服务器上使用操作系统验证连接数据库并连接catalog
% rman LOG /tmp/rman.log
% rman | tee rman.log
RMAN>
NLS_DATE_FORMAT 和NLS_LANG 参数来设置RMAN使用的语言和时间格式
NLS_LANG=american 如果RMAN客户端可以数据库的语言不同,会报错
NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'
本节内容:
- Entering RMAN Commands at the RMAN Prompt 使用RMAN提示输入命令
- Using Command Files with RMAN 使用命令文件
- Entering Comments in RMAN Command Files 编辑命令文件
- Using Substitution Variables in Command Files 在命令文件使用变量
- Checking RMAN Syntax 检查RMAN语法
RMAN> BACKUP DATABASE
2> INCLUDE CURRENT
3> CONTROLFILE
4> ;
% rman TARGET / @cmdfile1
RMAN> @cmdfile1
# Command file name: mybackup.rman #是注释符号
# The following command backs up the database
BACKUP DATABASE;
# The following command backs up the archived redo logs
BACKUP ARCHIVELOG ALL;
CONNECT TARGET /
RUN
{
ALLOCATE CHANNEL c1
DEVICE TYPE sbt
PARMS 'ENV=(OB_MEDIA_FAMILY=&1)';
BACKUP DATABASE
TAG &2
FORMAT '/disk2/bck/&1%U.bck'
KEEP FOREVER
RESTORE POINT &3;
}
EXIT;
#!/bin/tcsh
# name: runbackup.sh
# usage: use the tag name and number of copies as arguments
set media_family = $argv[1]
set format = $argv[2]set restore_point = $argv[3]
rman @'/disk1/scripts/whole_db.cmd' USING $media_family $format $restore_point
<3>执行shell
% runbackup.sh archival_backup bck0906 FY06Q3
5).Checking RMAN Syntax
CHECKSYNTAX 来检查命令的正确性CHECKSYNTAX 选项RMAN> backup database;
此命令不存在任何语法错误
检查脚本语法
- About RMAN Database Connections
- Connecting RMAN to an Auxiliary Database
- Making RMAN Database Connections Within Command Files
- Diagnosing RMAN Connection Problems
| Type of Database Connection | Keyword | Description |
|---|---|---|
|
|
A database to be backed up or restored by RMAN |
|
|
|
A database that provides an optional backup store for the RMAN repository in addition to the control file. |
|
|
|
A physical standby database, or a database instance created for performing a specific task such as creating a duplicate database, transporting tablespaces, or performingtablespace point-in-time recovery (TSPITR). For many tasks that use an auxiliary database, RMAN creates an automatic auxiliary instance for use during the task, connects to it, performs the task, and then destroys it when the task is completed. You do not give any explicit command to connect to automatic auxiliary instances. |
% ORACLE_SID=prod; export ORACLE_SID
% ORACLE_SID=prod; export ORACLE_SID
% rman TARGET SYS@prod
target database Password:
passwordconnected to target database: PROD1 (DBID=39525561)
| Value Used in Example | Meaning |
|---|---|
|
|
User with |
|
|
The net service name for the target database |
|
|
User that owns the recovery catalog schema. This is a user defined in the recovery catalog database that has been granted the |
|
|
The net service name for the recovery catalog database |
|
|
The net service name for an auxiliary instance |
% rman TARGET / NOCATALOG
connected to target database: PROD (DBID=39525561)
using target database control file instead of recovery catalog
RMAN>
% rman TARGET SYS@prod NOCATALOG
target database Password:
password
connected to target database: PROD (DBID=39525561)
RMAN>
% rman TARGET SYS@prod CATALOG rco@catdb
target database Password:
password
connected to target database: PROD (DBID=39525561)
recovery catalog database Password:
password
connected to recovery catalog database
RMAN>
RMAN> CONNECT TARGET /
RMAN> CONNECT CATALOG rco@catdb
RMAN> CONNECT TARGET SYS@prod
% rman
RMAN> CONNECT TARGET /
RMAN> CONNECT AUXILIARY SYS@aux
auxiliary database Password:
passwordconnected to auxiliary database: PROD (DBID=30472568)
cat > listbkup.rman << EOF
CONNECT TARGET /
LIST BACKUP;
EOF
% rman @listbkup.rman
RMAN> CONNECT TARGET *
2> LIST BACKUP;
3>
connected to target database: RDBMS (DBID=771530996)
using target database control file instead of recovery catalog
List of Backup Sets
===================
DBMS_PIPE 包来执行RMAN命令并输出结果,直接在SQLPLUS中执行.
DECLARE
2 V_INPUT VARCHAR2(32767) := 'BACKUP DATABASE;';
3 V_OUT NUMBER;
4 BEGIN
5 DBMS_PIPE.PACK_MESSAGE(V_INPUT);
6 V_OUT := DBMS_PIPE.SEND_MESSAGE('ORA$RMAN_P1_IN');
7 DBMS_OUTPUT.PUT_LINE(V_OUT);
8 COMMIT;
9 END;
10 /
0
启动 backup 于 02-4月 -06
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=16 devtype=DISK
通道 ORA_DISK_1: 正在启动 full 数据文件备份集
通道 ORA_DISK_1: 正在指定备份集中的数据文件
在备份集中包含当前的 SPFILE
备份集中包括当前控制文件
输入数据文件 fno=00001 name=F:ORACLEORADATATESTSYSTEM01.DBF
输入数据文件 fno=00002 name=F:ORACLEORADATATESTUNDOTBS01.DBF
输入数据文件 fno=00006 name=F:ORACLEORADATATESTYANGTK01.DBF
输入数据文件 fno=00003 name=F:ORACLEORADATATESTINDX01.DBF
输入数据文件 fno=00005 name=F:ORACLEORADATATESTUSERS01.DBF
输入数据文件 fno=00004 name=F:ORACLEORADATATESTTOOLS01.DBF
通道 ORA_DISK_1: 正在启动段 1 于 02-4月 -06
通道 ORA_DISK_1: 已完成段 1 于 02-4月 -06
段 handle=F:ORACLEORACLE920DATABASEIHFHTAE_1_1 comment=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:01:47
完成 backup 于 02-4月 -06
RMAN-00572: waiting for dbms_pipe input
PL/SQL 过程已成功完成。
官方文档 恢复备份指南四 Starting and Interacting with the RMAN Client的更多相关文章
- 官方文档 恢复备份指南三 Recovery Manager Architecture
本节讨论以下问题: About the RMAN Environment 关于RMAN环境 RMAN Command-Line Client ...
- 官方文档 恢复备份指南二 Getting Started with RMAN
本章对RMAN进行基本的熟悉和了解 1.Overview of the RMAN Environment RMAN运行时需要的最小环境: target database ...
- 官方文档 恢复备份指南一 Introduction to Backup and Recovery
1.备份分为:物理备份和逻辑备份 物理备份:备份数据文件 控制文件 归档日志文件 逻辑备份:EXP EXPDP备份等 物理备份为主,逻辑做补充 2.错误的类型 ...
- 官方文档 恢复备份指南八 RMAN Backup Concepts
本章内容 Consistent and Inconsistent RMAN Backups Online Backups and Backup Mode Backup Sets Image Copie ...
- 官方文档 恢复备份指南六 Configuring the RMAN Environment: Advanced Topics
RMAN高级设置. 本章内容: Configuring Advanced Channel Options 高级通道选项 Configuring Advanced Backup Options 高级备 ...
- 官方文档 恢复备份指南七 Using Flashback Database and Restore Points
本章内容: Understanding Flashback Database, Restore Points and Guaranteed Restore Points Logging for Fla ...
- 官方文档 恢复备份指南五 Configuring the RMAN Environment
本章内容: Configuring the Environment for RMAN Backups 配置RMAN环境 Configuring RMAN to Make Backups to a ...
- 《KAFKA官方文档》入门指南(转)
1.入门指南 1.1简介 Apache的Kafka™是一个分布式流平台(a distributed streaming platform).这到底意味着什么? 我们认为,一个流处理平台应该具有三个关键 ...
- Protocol Buffers(Protobuf) 官方文档--Protobuf语言指南
Protocol Buffers(Protobuf) 官方文档--Protobuf语言指南 约定:为方便书写,ProtocolBuffers在下文中将已Protobuf代替. 本指南将向您描述如何使用 ...
随机推荐
- o'Reill的SVG精髓(第二版)学习笔记——第九章
第九章:文本 9.1 字符:在XML文档中,字符是指带有一个数字值的一个或多个字节,数字只与Unicode标准对应. 符号:符号(glyph)是指字符的视觉呈现.每个字符都可以用很多不同的符号来呈现. ...
- IO Jar包
密码e7ed https://pan.baidu.com/share/init?surl=LakzlwrjolWwpoft5j6aBg
- php第三节(运算符)
<?php //算术运算符 + - * / % //++ 前加加 先做加运算后座赋值运算 后加加 先做赋值运算后座加运算 //-- 前减减 先做加运算后座赋值运算 后减减 先做赋值运算后座加运算 ...
- [国家集训队]小Z的袜子(莫队,概率)
题目描述 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿.终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命…… 具体来说,小Z把这N只袜子从1到N编 ...
- Java分享笔记:自定义枚举类 & 使用enum关键字定义枚举类
在JDK1.5之前没有enum关键字,如果想使用枚举类,程序员需要根据Java语言的规则自行设计.从JDK1.5开始,Java语言添加了enum关键字,可以通过该关键字方便地定义枚举类.这种枚举类有自 ...
- Java OOP——第四章 异常
1. 接口:接口就是给出一些没有内容的方法,封装到一起,到某个类要使用的时候,在根据具体情况把这些方法写出来. 接口是更加抽象的抽象的类, 抽象类里的方法可以有方法体, 接口里的所有方法都没有方法体. ...
- PHP入门笔记--基础语法二
一.函数 自定义函数 任何有效的 PHP 代码都有可能出现在函数内部,甚至包括其它函数和类定义. <?php function foo() { function bar() { echo &qu ...
- Hadoop(4)--Hbase
Hadoop 其它组成角色介绍--Hbase 在apache的官方网站上,对于Hbase的定义是他是Hadoop的第一个分布式.可扩展的大数据存储的数据库,他的目标是将非常大的表托管到一个集群中进行相 ...
- hive-show-partitions
展示分区命令 show partitions show partitions 可以展示这个表格之下的所有分区信息.这个命令常常用在使用SQL语句操作数据之前.举个简单的例子,如果我们想要根据uid融合 ...
- jenkins邮件发送jmeter接口测试报告
在Jenkins中配置实现邮件通知,Jenkins提供了两种方式的配置. 一种是Jenkins内置默认的邮件通知,但是它本身有很多局限性,比如它的邮件通知无法提供详细的邮件内容.无法定义发送邮件的格式 ...