登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

飞哥的技术博客

世上无难事,只怕有心人!

 
 
 

日志

 
 
 
 

RMAN的学习笔记(1)--RMAN的环境变量的设置对RMAN的影响 - daimin's BLOG - CSDN博客  

2009-06-23 20:23:18|  分类: Oracle |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

  RMAN的学习笔记(1)--RMAN的环境变量的设置对RMAN的影响收藏

 

刚刚开始RMAN,读到第三章的RMAN的环境变量的设置对RMAN的影响,这些环境变量是:NLS_DATE_FORMATNLS_LANG。

设置的目的主要是因为在RMAN中命令行中许多的命令参数都与时间有关,入:RESTORE,RECOVER以及REPORT。

当数据库在还处于nomount状态时,此时有使用RMAN还没有连接到目标数据库,然后mount目标数据库,此种情况下对RMAN需要和目标数据库中的NLS_LANG的保持一致;如果不一致,则RMAN登陆不进去;

测试如下:

[oracle@localhost oracle]$ export NLS_LANG=american

[oracle@localhost oracle]$ sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Aug 21 21:32:06 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> connect / as sysdba

Connected.

SQL> show parameter NLS_LANG

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

nls_language

如果执行如下:

[oracle@localhost oracle]$ 设置了不同于目标数据库中的字符集类型不一致,则在rman登陆时就报错

[oracle@localhost oracle]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-00554: initialization of internal recovery manager package failed

RMAN-04005: error from target database:

ORA-12705: invalid or unknown NLS parameter value specified

当数据库在还处于nomount状态时,此时有使用RMAN连接到目标数据库中并且目标数据库mount之后没有仍旧连着没有断开,在没有mount之前目标数据库会话中的字符集假设是export NLS_LANG=american,然后在mount之前对目标数据库所在的会话修改了其字符集改为export NLS_LANG=american.we8dec,再mount目标数据库,那么再在其刚才连着的RMAN会话命令中输入命令则会报错。

测试如下:

[oracle@localhost oracle]$ export NLS_LANG=American –mount目标数据库之前的字符集

[oracle@localhost oracle]$ sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Aug 21 21:32:06 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> connect / as sysdba

Connected.

SQL> shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL>目标数据库

ORACLE instance started.

Fixed Size                   451844 bytes

Database Buffers           16777216 bytes

Redo Buffers                 667648 bytes

SQL> show parameter NLS_LANG

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

nls_language                         string      AMERICAN

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

[oracle@localhost oracle]$ export NLS_LANG=AMERICAN –与还没有mount的目标数据库中的会话字符集类型一样,是AMERCAN

[oracle@localhost oracle]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: ora9i (not mounted)

再回到还没有mount的目标数据库会话中,继续如下操作:修改会话字符集,然后mount目标数据库:

测试如下:

[oracle@localhost oracle]$ sqlplus /nolog

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Aug 21 21:46:46 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> connect / as sysdba

Connected.

NAME                                 TYPE       VALUE

------------------------------------ ----------- ------------------------------

nls_language                         string      AMERICAN

SQL> alter database mount ;  --mount目标数据库

Database altered.

再回到刚刚在目标数据库处于nomount状态下连接RMAN的登陆环境中,输入一个命令则会报有关字符集的错误,测试如下:

RMAN> BACKUP DATABASE ;

Starting backup at Aug 21 2008 21:48:03

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of backup command at 08/21/2008 21:48:03

ORA-06550: line 1, column 43:

PLS-00553: character set name is not recognized

ORA-06550: line 0, column 0:

PL/SQL: Compilation unit analysis terminated

但如果断开此时的RMAN连接,重新设置下会话的NLS_LANG,再继续登陆RMAN,再执行BACKUP DATABASE ;命令,则不再报字符集类似的错误。

测试如下:

RMAN> exit

Recovery Manager complete.

[oracle@localhost oracle]$ export NLS_LANG=american.we8dec

[oracle@localhost oracle]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: ORA9I (DBID=2447264884)

RMAN> BACKUP DATABASE ;

Starting backup at Aug 21 2008 21:48:29

using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=10 devtype=DISK

channel ORA_DISK_1: starting full datafile backupset

channel ORA_DISK_1: specifying datafile(s) in backupset

including current SPFILE in backupset

including current controlfile in backupset

input datafile fno=00013 >

input datafile fno=00001 >

input datafile fno=00009 >

input datafile fno=00005 >

input datafile fno=00011 >

input datafile fno=00010 >

input datafile fno=00006 >

input datafile fno=00003 >

input datafile fno=00004 >

input datafile fno=00007 >

input datafile fno=00002 >

input datafile fno=00008 >

input datafile fno=00015 >

input datafile fno=00012 >

channel ORA_DISK_1: starting piece 1 at Aug 21 2008 21:48:33
channel ORA_DISK_1: finished piece 1 at Aug 21 2008 22:11:34
piece handle=/opt/ora9/product/9.2/dbs/02jokfhe_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:23:09
Finished backup at Aug 21 2008 22:11:42

本篇文章主要讲了RMAN的环境变量NLS_LANG以及NLS_DATE_FORMAT的设置对RMAN的影响。

  评论这张
 
阅读(529)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018