[20190225]ORA-07217錯誤.txt

lfree發表於2019-02-25

[20190225]ORA-07217錯誤.txt


--//昨天看連結: ,裡面提到一個情況,就是如果建立的

--//資料檔案包含$,會導致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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章