2016年8月11日 星期四

【Oracle 筆記 】也談 Oracle 上 Patch 的工具 admsi.pl

一般 Oracle Metalink 提供的 Patch 包會內含 Readme 檔案,指示該如何正確上此 patch,而 Oracle 也提供另一個工具 admsi.pl ,解析操作環境,而產生一個 install instruction 的檔案做為上 Patch 的參考。藉由以下 try and error 的方式,進行對此工具初步的了解。

執行下列指令:


[test@dev patch]$  perl /u01/apps/TEST/apps/apps_st/appl/ad/12.0.0/bin/admsi.pl  -patch_top=/u01/patch/10148526 -appspass=apps

Gathering Information..
Error:

ERROR: can't open log file: admsi.log: Permission denied


See admsi.log for more details.

這錯誤原因是 admsi.log 的 default 目錄是在 patch number 目錄下產生,所以我們需在Patch 的目錄下,執行 admsi.pl 指令。


[test@dev patch]$ cd /u01/patch/10148526
[test@dev 10148526]$  perl /u01/apps/TEST/apps/apps_st/appl/ad/12.0.0/bin/admsi.pl  -patch_top=/u01/patch/10148526 -appspass=apps

此外,在 /u01/apps/TEST/apps/apps_st/appl/ad/12.0.0/bin 目錄下的 admsi_main.pl 也有說明:


     : Name of the log file (optional),
                    By default, the file admsi.log in
                    the current directory is created and used.
                    (optional)

執行 admsi.pl 後,檢視此檔案 admsi.log,發現還有另外的錯誤:


[test@dev 10148526]$ vi admsi.log
Log for admsi_main.pl, started at 2014-10-30 09:32:22
************************************************
Establishing connection to the database with the following parameters:
SID      : TEST
User     : APPS

Error:

Unable to connect to TEST database.

 ORA-01017: invalid username/password; logon denied (DBD ERROR: OCISessionBegin)

最後將 apps 的密碼更正後, 執行結果如下:


[mgr@dev 10148526]$ perl /u01/apps/TEST/apps/apps_st/appl/ad/12.0.0/bin/admsi.pl  -patch_top=/u01/patch/10148526 -appspass=elvismeng

Gathering Information..
Logfile for this session is located at admsi.log
Generating installation instructions for patch 10148526..
Updating database....
install_10148526.html generated successfully
install_10148526.txt generated successfully

再次檢查 admsi.log 檔案內容:


[test@dev 10148526]$ vi admsi.log
Log for admsi_main.pl, started at 2014-10-30 09:48:00
************************************************
Establishing connection to the database with the following parameters:
SID      : TEST
User     : APPS

Parsing metadata file /u01/patch/10148526/patch_metadata.xml..
Loading data from Manual Step Files..


/u01/patch/10148526/ad/patch/115/manualsteps/ad_apply_patch.xml:
Parsing..
Validating..
Checking whether this step is applicable to this instance..
Yes, This step is applicable for this instance.

Executing begin  :value := ad_manual_step_object.is_step_already_done

('ad_apply_patch','120.4'); end;
Generating installation instructions for patch 10148526..
Updating database....
install_10148526.html generated successfully
install_10148526.txt generated successfully
Performing final cleanup..

若要指定 admsi.pl 的 log 檔案,則須註明 -log 如下:


[test@dev 10148526]$ perl /u01/apps/TEST/apps/apps_st/appl/ad/12.0.0/bin/admsi.pl  -patch_top=/u01/patch/10148526 -appspass=apps4 -log=elvis_admsi.log

Gathering Information..
Logfile for this session is located at elvis_admsi.log
Generating installation instructions for patch 10148526..
Updating database....
install_10148526.html generated successfully
install_10148526.txt generated successfully

最後別忘了,在執行 admsi.pl 指令後,在 patch number 的目錄下產生了兩個 install instruction 指示檔案: install_10148526.html 與 install_10148526。

附註:

[test@dev]$ admsi.pl -help

         USAGE: admsi.pl [-[-]patch_top=<patch_directory>]
                         [-[-]appsschema=<apps schema name>]
                         [-[-]appspass=<apps password>]
                         [-[-]log=<logfilename>]
                         [-[-]help] [-[-]debug] [-[-]all]
                         [-[-]force][-[-]done]
          WHERE:
           <patch_directory> : Patch top directory location (optional)
                               Prompts if not passed.
           <appsschema>      : Name of the APPS schema (optional)
                               Defaults to "APPS" if not passed.
           <appspass>        : Password for the apps user(optional),
                               Prompts if not passed.
           <logfilename>     : Name of the log file (optional),
                               By default, the file admsi.log in
                               the current directory is created and used.
                               (optional)
            -debug           : Runs admsi.pl in debug mode.(optional)
            -cli             : Runs admsi.pl to generate an installation
                               instructions for a patch using command line
                               interface.
            -gui             : Invokes the oracle installation instructions
                               generator (default).
            -all             : Shows all steps even if it is not applicable to
                               this instance.(optional)
            -force           : Shows all the applicable steps even if it is
                               already done.(optional)
            [-]-done         : Updates the manual steps as completed(optional).
         admsi.pl [-]-help provides usage information.

沒有留言:

張貼留言

prettyPrint();