環境:AIX 6.1 + Oracle 10.2.0.4
現象:在做xtts測試時,源環境使用Oracle自帶的perl執行xttdriver.pl報錯如下:
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl
Can't locate Getopt/Long.pm in @INC (@INC contains: /project/aix5l64/main/APACHE/perl/bin/AIX/Opt/lib/5.8.3/aix-thread-multi /project/aix5l64/main/APACHE/perl/bin/AIX/Opt/lib/5.8.3 /project/aix5l64/main/APACHE/perl/bin/AIX/Opt/lib/site_perl/5.8.3/aix-thread-multi /project/aix5l64/main/APACHE/perl/bin/AIX/Opt/lib/site_perl/5.8.3 /project/aix5l64/main/APACHE/perl/bin/AIX/Opt/lib/site_perl .) at xttdriver.pl line 126.
BEGIN failed--compilation aborted at xttdriver.pl line 126.
而在目標環境Linux6.8 + Oracle 11.2.0.4 就正常,起初我沒多想這個問題,以為是10g的自帶perl版本過低不支持,第一輪測試使用了系統自帶perl可執行。
但在后續測試中發現系統自帶的perl在執行過程中也是有很多類似錯誤,雖然最終完成,但擔心有其他隱患,和有經驗的同事進一步溝通,得知之前成功的xtts項目都是采用oracle自帶的perl,某些版本報這個錯誤是需要額外設置環境變量。
具體依據下面的MOS文檔,需要設置PER5LIB環境變量:
- perl xttdriver.pl fails: Can't locate Getopt/Long.pm in @INC (文檔 ID 1912400.1)
臨時設置PERL5LIB環境變量:
$ export PERL5LIB=$ORACLE_HOME/perl/lib
再次使用Oracle自帶的perl執行xttdriver.pl不再報之前的錯誤,這里測試沒加參數,就正常列出了xttdriver.pl的使用方法:
$ $ORACLE_HOME/perl/bin/perl xttdriver.pl
============================================================
trace file is /tmp/Nov15_Thu_16_29_45_413//Nov15_Thu_16_29_45_413_.log
=============================================================
--------------------------------------------------------------------
Parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done parsing properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Checking properties
--------------------------------------------------------------------
--------------------------------------------------------------------
Done checking properties
--------------------------------------------------------------------
This program prepares, backsup and rollsforward tablespaces
for cross-platform transportable tablespaces.
usage: xttdriver.pl
{[--backup|-b] || [--bkpincr|-B] || [--bkpexport/E]
[--resincrdmp|M]
[--fixnewdf|W]
[--convert/-c] || [--generate|-e] || [--incremental|-i] ||
[[--prepare|-p] || [--getfile|-G]] ||
[--restore|R] || [--recover|X]
[--rollforward|-r [--rolltbs|-T <TBS1[,TBS2]>] ||
[--determinescn|-s] ||
[--orasid/O] || [--orahome|-o]]
[--help|-h]}
Additional options
------------------
[--debug|d] [--clearerrorfile|-C] [--xttdir|Dir <tmpdir>]
[-F/--propfile] [-I/--propdir]
-b : For 12c and above, generate transportable backups
-B : For 12c and above, generate level 1 transportable backups
-c : conversion of datafiles
-M : create the dump file from the generated backup
-e : generate impdp script: export over new link
-i : incremental backup
-p : prepare
-G : get datafiles from source database using get_file, should not
be used together with -p
-r : roll forward datafiles
-s : new from_scn values into xttplan.txt
-R : For 12c restore the datafiles from the backups
-X : For 12c recover the datafiles from the backups
-T : roll forward specific tablespace(s)
-h : this (help) message (Default)
-d : provides more debug information, also rman is called with debug
option so that tracing is better.
-L : delete the ERROR FILE and proceed with the execution
-D : Instead of defining environement variable, user can pass tmpdir
through xttdir
-O : Use this option to pass ORACLE_SID to override the environment
variable
-o : Use this option to pass ORACLE_HOME to override the environment
variable
-I : Use this option to mention the location from where the script
will pick the properties file etc
-F : Use this option to mention the location from where the script
will pick the properties file.
-W : Will try to reconstruct files on the destination after new
datafiles have been added
example: xttdriver.pl -p
xttdriver.pl -i
xttdriver.pl -r
xttdriver.pl -s
$
既然如此,后續還是建議使用oracle自帶的perl進行測試。
2018-11-18修正說明:最終發現這個不算是問題,因為實際上源端我使用系統自帶的perl也並沒有任何報錯,實際報錯是目標端perl在進行增量恢復時有報錯,具體是"Can't locate strict.pm in @INC...",雖然看起來和上文很像,但模塊名稱有區別,而從MOS文檔Migrate database to Exadata with DBMS_FILE_TRANSFER (文檔 ID 1902618.1)中可以看到這個錯誤實際是可以忽略的,原話是:
It is safe to ignore the "Can't locate strict.pm in @INC..." messages. We believe those are the result of the Perl pragma 'use strict' in the asmcmdcore.