[20190225]ORA-07217错误.txt

[20190225]ORA-07217错误.txt


--//昨天看链接:http://www.xifenfei.com/2019/02/ora-07217.html ,里面提到一个情况,就是如果建立的

--//数据文件包含$,会导致dg启动到mount报ORA-07217:sltln: environment variable cannot be evaluated.错误.

--//自己测试看看:


1.环境:

SCOTT@book> @ ver1

PORT_STRING         VERSION    BANNER

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

x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


SYS@book> show parameter db_file_name_convert

NAME                 TYPE   VALUE

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

db_file_name_convert string /mnt/ramdisk/book, /mnt/ramdisk/book


--//检查备库日志是否应用正常.

SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24128 CONNECTED    ARCH     N/A          0          0          0          0          0

ARCH        24130 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24163 IDLE         ARCH     N/A          0          0          0          0          0

RFS         24149 IDLE         LGWR     1            1        698        122          1          0

ARCH        24126 CLOSING      ARCH     4            1        695          1        154          0

ARCH        24132 CLOSING      ARCH     5            1        697          1         25          0

MRP0        24151 APPLYING_LOG N/A      N/A          1        698        122     102400          0

7 rows selected.


2.在主库建立数据文件,数据文件包含$:

$ cat sugar.txt

CREATE TABLESPACE SUGAR DATAFILE

  '/mnt/ramdisk/book/su$ar01.dbf' SIZE 10M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED

LOGGING

ONLINE

EXTENT MANAGEMENT LOCAL AUTOALLOCATE

BLOCKSIZE 8K

SEGMENT SPACE MANAGEMENT AUTO

FLASHBACK ON;


SYS@book> @ sugar.txt

CREATE TABLESPACE SUGAR DATAFILE

*

ERROR at line 1:

ORA-07217: sltln: environment variable cannot be evaluated.


$ oerr ora 07217

07217, 00000, "sltln: environment variable cannot be evaluated."

// *Cause:  getenv call returned a null pointer.

// *Action: Set the environment variable and try again.


--//实际上建立时就保ORA-07217: sltln: environment variable cannot be evaluated.错误.

--//在toad下建立看看,走菜单建立也是报错.修改如下:


CREATE TABLESPACE SUGAR DATAFILE

  '/mnt/ramdisk/book/su\$ar01.dbf' SIZE 10M AUTOEXTEND ON NEXT 16M MAXSIZE UNLIMITED

LOGGING

ONLINE

EXTENT MANAGEMENT LOCAL AUTOALLOCATE

BLOCKSIZE 8K

SEGMENT SPACE MANAGEMENT AUTO

FLASHBACK ON;


--//报错如下:

*

ERROR at line 1:

ORA-00600: internal error code, arguments: [ksfd_odmcrt2], [Invalid argument], [], [], [], [], [], [], [], [], [], []


--//奇怪,我在主库根本无法建立数据文件包含$的文件.取消db_file_name_convert参数再测试看看.


SYS@book> alter system reset db_file_name_convert;

System altered.


--//依旧包ORA-07217: sltln: environment variable cannot be evaluated.,或者

--//ORA-00600: internal error code, arguments: [ksfd_odmcrt2], [Invalid argument], [], [], [], [], [], [], [], [], [], []

--//真不知道如何建立这样数据文件.


3.继续测试:

--//建立环境变量看看:

$ export ar01='$ar01'

SYS@book> alter system set db_file_name_convert='/mnt/ramdisk/book','/mnt/ramdisk/book' scope=spfile;

System altered.


--//重启数据库:

SYS@book> @ sugar.txt

Tablespace created.


--//OK.这样建立成功.

$ ls -l /mnt/ramdisk/book/su\$ar01.dbf

-rw-r----- 1 oracle oinstall 10493952 2019-02-25 09:14:13 /mnt/ramdisk/book/su$ar01.dbf


--//不会链接巧合也建立环境变量吧.真不知道源链接数据文件如何建立的.


4.到dg查看,日志是否应用正常,数据文件是否建立.

SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24130 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24193 IDLE         UNKNOWN  N/A          0          0          0          0          0

RFS         24195 IDLE         LGWR     3            1        700          3          1          0

ARCH        24126 CLOSING      ARCH     4            1        695          1        154          0

ARCH        24128 CLOSING      ARCH     4            1        699          1       1909          0

ARCH        24132 CLOSING      ARCH     6            1        698       4096        384          0

MRP0        24151 APPLYING_LOG N/A      N/A          1        699        898       1909          0

7 rows selected.


SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24130 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24193 IDLE         UNKNOWN  N/A          0          0          0          0          0

RFS         24195 IDLE         LGWR     3            1        700          4          1          0

ARCH        24128 CLOSING      ARCH     4            1        699          1       1909          0

ARCH        24126 CLOSING      ARCH     4            1        695          1        154          0

ARCH        24132 CLOSING      ARCH     6            1        698       4096        384          0

6 rows selected.

--//可以发现dg日志应用已经停止.

--//检查alert文件发现如下:


Mon Feb 25 09:17:46 2019

Archived Log entry 7 added for thread 1 sequence 699 ID 0x4fb7d86e dest 1:

Media Recovery Log /u01/app/oracle/archivelog/book/1_699_896605872.dbf

Errors with log /u01/app/oracle/archivelog/book/1_699_896605872.dbf

MRP0: Background Media Recovery terminated with error 7217

Errors in file /u01/app/oracle/diag/rdbms/bookdg/bookdg/trace/bookdg_pr00_24153.trc:

ORA-07217: sltln: environment variable cannot be evaluated.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Managed Standby Recovery not using Real Time Apply

Recovery interrupted!

Recovered data files to a consistent state at change 13276937052

Mon Feb 25 09:17:47 2019

MRP0: Background Media Recovery process shutdown (bookdg)


--//注:注意看下划线内容,MRP0进程shutdown.实际上正如惜分飞说的那样,不要在建立文件包含特殊符号.

--//你可以发现在rman备份时如果没有定义环境变量ar01.报错如下:

$ export ar01=


RMAN> backup as copy datafile 7 format '/tmp/%b';

Starting backup at 2019-02-25 09:21:05

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=54 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=67 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=80 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00007 name=/mnt/ramdisk/book/su$ar01.dbf

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

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

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

RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/25/2019 09:21:06

ORA-07217: sltln: environment variable cannot be evaluated.


$ export ar01='$ar01'


RMAN> backup as copy datafile 7 format '/tmp/%b';

Starting backup at 2019-02-25 09:25:08

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=41 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=54 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=67 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00007 name=/mnt/ramdisk/book/su$ar01.dbf

output file name=/tmp/su$ar01.dbf tag=TAG20190225T092509 RECID=13 STAMP=1001150709

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 2019-02-25 09:25:10

Starting Control File and SPFILE Autobackup at 2019-02-25 09:25:10

piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2019_02_25/o1_mf_s_1001150710_g76jzq0x_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 2019-02-25 09:25:11

--//环境变量正确,备份ok.


$ export ar01='$xxxx'


RMAN> backup as copy datafile 7 format '/tmp/aa%b';

Starting backup at 2019-02-25 09:25:42

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=41 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=54 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=67 device type=DISK

channel ORA_DISK_1: starting datafile copy

input datafile file number=00007 name=/mnt/ramdisk/book/su$ar01.dbf

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

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

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

RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/25/2019 09:25:45

ORA-07217: sltln: environment variable cannot be evaluated.


4.解决方法就是改名:

--//主库:

SYS@book> alter tablespace sugar offline;

Tablespace altered.


$ mv /mnt/ramdisk/book/su\$ar01.dbf /mnt/ramdisk/book/sugar01.dbf

`/mnt/ramdisk/book/su$ar01.dbf' -> `/mnt/ramdisk/book/sugar01.dbf'


--//顺便测试环境变量不存在的情况:

$ export ar01=


SYS@book> alter database rename file '/mnt/ramdisk/book/su\$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf';

alter database rename file '/mnt/ramdisk/book/su\$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-07217: sltln: environment variable cannot be evaluated.


SYS@book> alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf';

alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-07217: sltln: environment variable cannot be evaluated.

--//2种方式都不行!简直就是给自己下坑...


$ export ar01='$ar01'

SYS@book> alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf';

Database altered.


SYS@book> alter tablespace sugar online;

Tablespace altered.


5.备库:

$ export ar01='$ar01'


SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;

Database altered.


SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24130 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24197 IDLE         ARCH     N/A          0          0          0          0          0

RFS         24195 IDLE         LGWR     3            1        700       1533          1          0

ARCH        24128 CLOSING      ARCH     4            1        699          1       1909          0

ARCH        24126 CLOSING      ARCH     4            1        695          1        154          0

ARCH        24132 CLOSING      ARCH     6            1        698       4096        384          0

6 rows selected.

--//mrp0进程无法启动,重启再测试,问题依旧.报 ORA-07217: sltln: environment variable cannot be evaluated.


SYS@bookdg> alter system reset db_file_name_convert;

System altered.


--//再次重启

SYS@bookdg> shutdown immediate ;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@bookdg> startup

ORACLE instance started.

Total System Global Area  634732544 bytes

Fixed Size                  2255792 bytes

Variable Size             197133392 bytes

Database Buffers          427819008 bytes

Redo Buffers                7524352 bytes

Database mounted.

Database opened.

SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;

Database altered.


SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24427 CONNECTED    ARCH     N/A          0          0          0          0          0

ARCH        24429 CONNECTED    ARCH     N/A          0          0          0          0          0

ARCH        24431 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24438 IDLE         UNKNOWN  N/A          0          0          0          0          0

RFS         24440 IDLE         LGWR     1            1        707         35          1          0

ARCH        24433 CLOSING      ARCH     4            1        706          1         35          0

MRP0        24442 APPLYING_LOG N/A      N/A          1        701      41954      88976          0

7 rows selected.


--//取消db_file_name_convert定义,确实可以ok,备库上数据文件也建立.

$ ls -l /mnt/ramdisk/book/su\$ar01.dbf

-rw-r-----  1 oracle oinstall 10493952 2019-02-25 09:45:54 /mnt/ramdisk/book/su$ar01.dbf


--//dg下数据文件改名比较特殊,必须在mount下进行.我不知道有什么好方法.注意一定要先定义环境变量$ export ar01='$ar01'才ok.不然一样报ora-07217


$ export ar01='$ar01'

SYS@bookdg> startup mount;

ORACLE instance started.

Total System Global Area  634732544 bytes

Fixed Size                  2255792 bytes

Variable Size             197133392 bytes

Database Buffers          427819008 bytes

Redo Buffers                7524352 bytes

Database mounted.


$ mv /mnt/ramdisk/book/su\$ar01.dbf /mnt/ramdisk/book/sugar01.dbf


SYS@bookdg> alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf';

alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf'

*

ERROR at line 1:

ORA-01511: error in renaming log/data files

ORA-01275: Operation RENAME is not allowed if standby file management is automatic.


--//要修改参数standby_file_management=manual.

SYS@bookdg> alter system set standby_file_management=manual scope=memory;

System altered.


SYS@bookdg> alter database rename file '/mnt/ramdisk/book/su$ar01.dbf' to '/mnt/ramdisk/book/sugar01.dbf';

Database altered.


SYS@bookdg> alter database open read only ;

Database altered.


SYS@bookdg> alter database recover managed standby database using current logfile disconnect ;

Database altered.


SYS@bookdg> @ dg/dg

PROCESS       PID STATUS       CLIENT_P GROUP# THREAD#  SEQUENCE#     BLOCK#     BLOCKS DELAY_MINS

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

ARCH        24514 CONNECTED    ARCH     N/A          0          0          0          0          0

ARCH        24516 CONNECTED    ARCH     N/A          0          0          0          0          0

ARCH        24518 CONNECTED    ARCH     N/A          0          0          0          0          0

RFS         24530 IDLE         ARCH     N/A          0          0          0          0          0

ARCH        24520 CLOSING      ARCH     5            1        707          1        210          0

MRP0        24582 APPLYING_LOG N/A      N/A          1        708         42     102400          0

6 rows selected.


6.收尾:


SYS@bookdg> alter system set db_file_name_convert='/mnt/ramdisk/book','/mnt/ramdisk/book' scope=spfile;

System altered.


SYS@bookdg> alter system set standby_file_management=auto;

System altered.


--//总之规范管理很重要.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2636864/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/267265/viewspace-2636864/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值