1. 工具用法
1 su - oracle 2 $ $(orabasehome)/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl 3 4 Usage: catcon [-h, --help] 5 [-u, --usr username 6 [{/password | -w, --usr_pwd_env_var env-var-name}]] 7 [-U, --int_usr username 8 [{/password | -W, --int_usr_pwd_env_var env-var-name]] 9 [-d, --script_dir directory] 10 [-l, --log_dir directory] 11 [{-c, --incl_con | -C, --excl_con} container] 12 [-p, --catcon_instances degree-of-parallelism] 13 [-z, --ez_conn EZConnect-strings] 14 [-e, --echo] 15 [-s, --spool] 16 [-E, --error_logging 17 { ON | errorlogging-table-other-than-SPERRORLOG } ] 18 [-F, --app_con Application-Root] 19 [-V, --ignore_errors errors-to-ignore ] 20 [-I, --no_set_errlog_ident] 21 [-g, --diag] 22 [-v, --verbose] 23 [-f, --ignore_unavailable_pdbs] 24 [-r, --reverse] 25 [-R, --recover] 26 [-m, --pdb_seed_mode pdb-mode] 27 [--force_pdb_mode pdb-mode] 28 [--all_instances] 29 -b, --log_file_base log-file-name-base 30 -- 31 { sqlplus-script [arguments] | --x<SQL-statement> } ... 32 33 Optional: 34 -h, --help 35 print usage info and exit 36 -u, --usr 37 username (optional /password; otherwise prompts for password) 38 used to connect to the database to run user-supplied scripts or 39 SQL statements 40 defaults to "/ as sysdba" 41 -w, --usr_pwd_env_var 42 name of environment variable which contains a password for a user 43 whose name was specified with --usr; 44 NOTE: should NOT be used if --usr specified a password 45 -U, --int_usr 46 username (optional /password; otherwise prompts for password) 47 used to connect to the database to perform internal tasks 48 defaults to "/ as sysdba" 49 -W, --int_usr_pwd_env_var 50 name of environment variable which contains a password for a user 51 whose name was specified with --int_usr; 52 NOTE: should NOT be used if --int_usr specified a password 53 -d, --script_dir 54 directory containing the file to be run 55 -l, --log_dir 56 directory to use for spool log files 57 -c, --incl_con 58 container(s) in which to run sqlplus scripts, i.e. skip all 59 Containers not named here; for example, 60 --incl_con 'PDB1 PDB2', 61 -C, --excl_con 62 container(s) in which NOT to run sqlplus scripts, i.e. skip all 63 Containers named here; for example, 64 --excl_con 'CDB PDB3' 65 66 NOTE: --incl_con and --excl_con are mutually exclusive 67 68 -p, --catcon_instances 69 expected number of concurrent invocations of this script on a given 70 host 71 72 NOTE: this parameter rarely needs to be specified 73 74 -z, --ez_conn 75 blank-separated EZConnect strings corresponding to RAC instances 76 which can be used to run scripts 77 -e, --echo 78 sets echo on while running sqlplus scripts 79 -s, --spool 80 output of running every script will be spooled into a file whose name 81 will be 82 <log-file-name-base>_<script_name_without_extension>_[<container_name_if_any>].<default_extension> 83 -E, --error_logging 84 sets errorlogging on; if ON is specified, default error logging table 85 will be used, otherwise, specified error logging table (which must 86 have been created in every Container) will be used 87 -F, --app_con 88 causes scripts to run in a Application Root and all Application PDBs 89 belonging to it; 90 ***CANNOT*** be specified concurrently with -{cC} flags 91 -V, --ignore_errors 92 causes catcon to ignore errors encountered during specified operations. 93 The following options are supported: 94 script_path == ignore errors while validating script path 95 -S, --optUserScripts 96 running user scripts, meaning that _oracle_script will not be set and 97 all entities created by scripts will not be marked as Oracle-maintained 98 -I, --no_set_errlog_ident 99 do not issue set Errorlogging Identifier (ostensibly because the 100 caller already did it and does not want us to override it) 101 -g, --diag 102 turns on production of diagnostic info while running this script 103 -v, --verbose 104 turns on verbose output which is less verbose than debugging output 105 -f, --ignore_unavailable_pdbs 106 instructs catcon to ignore PDBs which are closed or, if --incl_con or 107 --excl_con was used, do not exist and process existing PDBs which 108 were specified (explicitly or implicitly) and are open 109 110 NOTE: if this flag is not specified and some specified PDBs do not 111 exist or are not open, an error will be returned and none of 112 the Containers will be processed. 113 114 -r, --reverse 115 causes scripts to be run in all PDBs and then in the Root (reverse 116 of the default order); required for running catdwgrd.sql in a CDB 117 -m, --pdb_seed_mode 118 mode in which PDB should be opened; one of the following values 119 may be specified: 120 - UNCHANGED - leave PDB in whatever mode it is already open 121 - READ WRITE (default) 122 - READ ONLY 123 - UPGRADE 124 - DOWNGRADE 125 126 NOTE: if the desired mode is different from the mode in which 127 PDB is open, it is will be closed and reopened in the 128 desired mode before running any scripts; after all scripts were 129 run, it will be restored to the original mode 130 131 --pdb_seed_mode should not be specified if --force_pdb_mode 132 is specified because mode supplied with the latter will apply 133 to PDB 134 135 --force_pdb_mode 136 mode in which ALL PDBs against which scripts will be run must be 137 opened; one of the following values may be specified: 138 - UNCHANGED - leave PDBs in whatever mode they are already 139 open (default) 140 - READ WRITE 141 - READ ONLY 142 - UPGRADE 143 - DOWNGRADE 144 145 NOTE: if the desired mode is different from the mode in which 146 some of the PDBs specified by the caller are open, they will be 147 closed and reopened in the desired mode before running any 148 scripts; after all scripts were run, they will be restored to 149 the original mode 150 151 --force_pdb_mode should not be specified if --pdb_seed_mode 152 is specified because mode supplied with the latter will apply 153 to PDB 154 155 -R, --recover 156 causes catcon to recover from unexpected death of a SQL*Plus process 157 that it spawned; if not specified, such event will cause catcon to die 158 159 -D, --disable_lockdown 160 causes catcon to disable lockdown profile before running script(s) in 161 a PDB and reenable them before existing 162 163 --all_instances 164 if used to run scripts against a CDB and if --force_pdb_mode was 165 specified, catcon will attempt to run scripts on PDBs using all 166 instances on which a CDB is open 167 168 Mandatory: 169 -b, --log_file_base 170 base name (e.g. catcon_test) for log and spool file names 171 172 sqlplus-script - sqlplus script to run OR 173 SQL-statement - a statement to execute 174 175 NOTES: 176 - if --x<SQL-statement> is the first non-option string, it needs to be 177 preceeded with -- to avoid confusing module parsing options into 178 assuming that '-' is an option which that module is not expecting and 179 about which it will complain 180 - command line parameters to SQL scripts can be introduced using --p 181 - interactive (or secret) parameters to SQL scripts can be introduced 182 using --P 183 - occupying middle ground between --p and --P, parameters whose values 184 are stored in environment variables can be specified using --e 185 (as in --e"env_var_holding_password") 186 187 For example, 188 perl catcon.pl ... x.sql --p"John" --P"Enter Password for John:" ... 189 or store John's password in environment variable JOHNS_PASSWORD and 190 then issue 191 perl catcon.pl ... x.sql --p"John" --e"JOHNS_PASSWORD" ... 192 193 $
2. 安装JAVA相关组件
### ---- JServer.sql ---- ### # 指定container安装组件,每个container用空格符分割; LOG_DIR=/tmp/$(date +%Y%m%d) [[ -d "${LOG_DIR}" ]] || mkdir -p ${LOG_DIR} #-- JServer JAVA Virtual Machine JAVAVM $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b initjvm -c 'PDB$SEED' $(orabasehome)/javavm/install/initjvm.sql OR $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b initjvm -c 'PDB$SEED PDBORCL' $(orabasehome)/javavm/install/initjvm.sql -- Oracle XDK XML $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b initxml -c 'PDB$SEED' $(orabasehome)/xdk/admin/initxml.sql $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b xmlja -c PDB$SEED' $(orabasehome)/xdk/admin/xmlja.sql -- Oracle Database Java Packages CATJAVA $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b catjava -c 'PDB$SEED' $(orabasehome)/rdbms/admin/catjava.sql $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b catxdbj -c 'PDB$SEED' $(orabasehome)/rdbms/admin/catxdbj.sql
3. 其他组件类似
### ----ordinst.sql ---- ### -- run in cdb and all open pdbs $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b ordinst -a 1 $(orabasehome)/ord/admin/ordinst.sql 1SYSAUX 1SYSAUX; ### ---- interMedia.sql ---- ### -- Oracle Multimedia ORDIM $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b iminst -c 'PDB$SEED' $(orabasehome)/ord/im/admin/iminst.sql ### ---- cwmlite.sql ---- ### -- OLAP Analytic Workspace APS -- Oracle OLAP API XOQ $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b olap -c 'PDB$SEED' -a 1 $(orabasehome)/olap/admin/olap.sql 1SYSAUX 1TEMP; ### ---- spatial.sql ---- ### -- Spatial SDO $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b mdinst -c 'PDB$SEED' $(orabasehome)/md/admin/mdinst.sql ### ---- catols.sql ---- ### -- Oracle Label Security OLS $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b catols -c 'PDB$SEED CDB$ROOT' -U "SYS"/"&&sysPassword" $(orabasehome)/rdbms/admin/catols.sql; ### ---- apex.sql ---- ### -- Oracle Application Express APEX $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b catapx -c 'PDB$SEED' -a 1 $(orabasehome)/apex/catapx.sql 1Xbkfsdcdf1ggh_123 1SYSAUX 1SYSAUX 1TEMP 1/i/ 1NONE; ### ---- catmac.sql ---- ### -- Oracle Database Vault DV $(orabasehome)/perl/bin/perl $(orabasehome)/rdbms/admin/catcon.pl -n 1 -l ${LOG_DIR} -v -b catmac -c 'PDB$SEED CDB$ROOT' -a 1 $(orabasehome)/rdbms/admin/catmac.sql 1SYSAUX 1TEMP;