docker搭建oracle 11.2.0.3.0
dockerfile 如下:
1 FROM oraclelinux:7-slim 2 3 ARG ORACLE_BASE=/opt/oracle 4 ARG ORACLE_HOME=/opt/oracle/product/11.2.0.1/dbhome_1 5 ARG INSTALL_FILE="http://192.168.1.100:8000/database.tar" 6 ARG INSTALL_RSP="db_install.rsp" 7 ARG NETCA_RSP="netca.rsp" 8 ARG DBCA_RSP="dbca.rsp" 9 ARG REQUIRED_SPACE_GB=20 10 ARG proxy=192.168.1.100:3129 11 ARG INSTALL_DIR=$ORACLE_BASE/install 12 ARG PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:/usr/sbin:$PATH 13 ARG LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 14 ARG CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 15 16 # Copy binaries 17 COPY $INSTALL_RSP $NETCA_RSP $DBCA_RSP runOracle.sh /install/ 18 19 20 RUN sync && \ 21 if [ `df -PB 1G / | tail -n 1 | awk '{ print $4 }'` -lt $REQUIRED_SPACE_GB ]; then echo "ERROR:The container needs at least $REQUIRED_SPACE_GB GB !!!!!!!!!!!" && exit 1; fi &&\ 22 echo "proxy=http://${proxy}" >>/etc/yum.conf &&\ 23 echo "export http_proxy=${proxy}" >>/etc/profile &&\ 24 echo "export ORACLE_BASE=${ORACLE_BASE}">>/etc/profile &&\ 25 echo "export ORACLE_HOME=${ORACLE_HOME}">>/etc/profile &&\ 26 echo "export export PATH=\$ORACLE_HOME/bin:\$PATH">>/etc/profile &&\ 27 source /etc/profile &&\ 28 yum -y install oracle-rdbms-server-11gR2-preinstall tar openssl openssh-server vi && \ 29 ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N "" && \ 30 ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key -N "" && \ 31 sed -ri 's/^#PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \ 32 sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config && \ 33 mkdir /var/run/sshd && \ 34 mkdir -p $ORACLE_BASE/scripts/setup && \ 35 mkdir $ORACLE_BASE/scripts/startup && \ 36 ln -s $ORACLE_BASE/scripts /docker-entrypoint-initdb.d && \ 37 mkdir $ORACLE_BASE/oradata && \ 38 rm -rf /var/cache/yum && \ 39 echo 'root:root' |chpasswd && \ 40 echo 'oracle:oracle' | chpasswd && \ 41 chown -R oracle:dba $ORACLE_BASE 42 43 # Install DB software 44 USER oracle 45 RUN if [ ! -d $INSTALL_DIR ]; then cp -R /install $ORACLE_BASE ; fi && \ 46 sed -i -e "s|###ORACLE_BASE###|$ORACLE_BASE|g" $INSTALL_DIR/$INSTALL_RSP && \ 47 sed -i -e "s|###ORACLE_HOME###|$ORACLE_HOME|g" $INSTALL_DIR/$INSTALL_RSP && \ 48 # Install Oracle binaries 49 cd $INSTALL_DIR && \ 50 curl ${INSTALL_FILE}|tar -xv && \ 51 chmod -R 777 $INSTALL_DIR/database && \ 52 $INSTALL_DIR/database/runInstaller -ignoresysprereqs -ignoreprereq -silent -force -waitforcompletion -responsefile $INSTALL_DIR/$INSTALL_RSP && \ 53 ${ORACLE_HOME}/bin/netca /silent /responseFile $INSTALL_DIR/$NETCA_RSP && \ 54 sed -i -e "s|`hostname`|###hostname###|g" ${ORACLE_HOME}/network/admin/listener.ora && \ 55 #${ORACLE_HOME}/bin/dbca -silent -responseFile $INSTALL_DIR/$DBCA_RSP && \ 56 cd $HOME && \ 57 mv $INSTALL_DIR/runOracle.sh . && \ 58 echo "unset http_proxy" >> .bash_profile && \ 59 rm -rf $INSTALL_DIR/database || echo "rm $INSTALL_DIR/database Failed" 60 61 62 USER root 63 RUN $ORACLE_BASE/oraInventory/orainstRoot.sh && \ 64 $ORACLE_HOME/root.sh && \ 65 rm -rf /install 66 67 68 VOLUME ["$ORACLE_BASE/oradata"] 69 EXPOSE 1521 22 70 CMD ["/usr/sbin/sshd", "-D"]
db_install.rsp,如下
1 #################################################################### 2 ## Copyright(c) Oracle Corporation 1998,2011. All rights reserved.## 3 ## ## 4 ## Specify values for the variables listed below to customize ## 5 ## your installation. ## 6 ## ## 7 ## Each variable is associated with a comment. The comment ## 8 ## can help to populate the variables with the appropriate ## 9 ## values. ## 10 ## ## 11 ## IMPORTANT NOTE: This file contains plain text passwords and ## 12 ## should be secured to have read permission only by oracle user ## 13 ## or db administrator who owns this installation. ## 14 ## ## 15 #################################################################### 16 17 #------------------------------------------------------------------------------ 18 # Do not change the following system generated value. 19 #------------------------------------------------------------------------------ 20 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 21 22 #------------------------------------------------------------------------------ 23 # Specify the installation option. 24 # It can be one of the following: 25 # 1. INSTALL_DB_SWONLY 26 # 2. INSTALL_DB_AND_CONFIG 27 # 3. UPGRADE_DB 28 #------------------------------------------------------------------------------- 29 oracle.install.option=INSTALL_DB_SWONLY 30 31 #------------------------------------------------------------------------------- 32 # Specify the hostname of the system as set during the install. It can be used 33 # to force the installation to use an alternative hostname rather than using the 34 # first hostname found on the system. (e.g., for systems with multiple hostnames 35 # and network interfaces) 36 #------------------------------------------------------------------------------- 37 ORACLE_HOSTNAME=hostname 38 39 #------------------------------------------------------------------------------- 40 # Specify the Unix group to be set for the inventory directory. 41 #------------------------------------------------------------------------------- 42 UNIX_GROUP_NAME=dba 43 44 #------------------------------------------------------------------------------- 45 # Specify the location which holds the inventory files. 46 # This is an optional parameter if installing on 47 # Windows based Operating System. 48 #------------------------------------------------------------------------------- 49 INVENTORY_LOCATION=###ORACLE_BASE###/oraInventory 50 51 #------------------------------------------------------------------------------- 52 # Specify the languages in which the components will be installed. 53 # 54 # en : English ja : Japanese 55 # fr : French ko : Korean 56 # ar : Arabic es : Latin American Spanish 57 # bn : Bengali lv : Latvian 58 # pt_BR: Brazilian Portuguese lt : Lithuanian 59 # bg : Bulgarian ms : Malay 60 # fr_CA: Canadian French es_MX: Mexican Spanish 61 # ca : Catalan no : Norwegian 62 # hr : Croatian pl : Polish 63 # cs : Czech pt : Portuguese 64 # da : Danish ro : Romanian 65 # nl : Dutch ru : Russian 66 # ar_EG: Egyptian zh_CN: Simplified Chinese 67 # en_GB: English (Great Britain) sk : Slovak 68 # et : Estonian sl : Slovenian 69 # fi : Finnish es_ES: Spanish 70 # de : German sv : Swedish 71 # el : Greek th : Thai 72 # iw : Hebrew zh_TW: Traditional Chinese 73 # hu : Hungarian tr : Turkish 74 # is : Icelandic uk : Ukrainian 75 # in : Indonesian vi : Vietnamese 76 # it : Italian 77 # 78 # all_langs : All languages 79 # 80 # Specify value as the following to select any of the languages. 81 # Example : SELECTED_LANGUAGES=en,fr,ja 82 # 83 # Specify value as the following to select all the languages. 84 # Example : SELECTED_LANGUAGES=all_langs 85 #------------------------------------------------------------------------------ 86 SELECTED_LANGUAGES=en,zh_CN 87 88 #------------------------------------------------------------------------------ 89 # Specify the complete path of the Oracle Home. 90 #------------------------------------------------------------------------------ 91 ORACLE_HOME=###ORACLE_HOME### 92 93 #------------------------------------------------------------------------------ 94 # Specify the complete path of the Oracle Base. 95 #------------------------------------------------------------------------------ 96 ORACLE_BASE=###ORACLE_BASE### 97 98 #------------------------------------------------------------------------------ 99 # Specify the installation edition of the component. 100 # 101 # The value should contain only one of these choices. 102 # EE : Enterprise Edition 103 # SE : Standard Edition 104 # SEONE : Standard Edition One 105 # PE : Personal Edition (WINDOWS ONLY) 106 #------------------------------------------------------------------------------ 107 oracle.install.db.InstallEdition=EE 108 109 #------------------------------------------------------------------------------ 110 # This variable is used to enable or disable custom install and is considered 111 # only if InstallEdition is EE. 112 # 113 # true : Components mentioned as part of 'optionalComponents' property 114 # are considered for install. 115 # false : Value for 'optionalComponents' is not considered. 116 #------------------------------------------------------------------------------ 117 oracle.install.db.EEOptionsSelection=false 118 119 #------------------------------------------------------------------------------ 120 # This variable is considered only if 'EEOptionsSelection' is set to true. 121 # 122 # Description: List of Enterprise Edition Options you would like to enable. 123 # 124 # The following choices are available. You may specify any 125 # combination of these choices. The components you choose should 126 # be specified in the form "internal-component-name:version" 127 # Below is a list of components you may specify to enable. 128 # 129 # oracle.oraolap:11.2.0.3.0 - Oracle OLAP 130 # oracle.rdbms.dm:11.2.0.3.0 - Oracle Data Mining 131 # oracle.rdbms.dv:11.2.0.3.0 - Oracle Database Vault 132 # oracle.rdbms.lbac:11.2.0.3.0 - Oracle Label Security 133 # oracle.rdbms.partitioning:11.2.0.3.0 - Oracle Partitioning 134 # oracle.rdbms.rat:11.2.0.3.0 - Oracle Real Application Testing 135 #------------------------------------------------------------------------------ 136 oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.dv:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0 137 138 ############################################################################### 139 # # 140 # PRIVILEGED OPERATING SYSTEM GROUPS # 141 # ------------------------------------------ # 142 # Provide values for the OS groups to which OSDBA and OSOPER privileges # 143 # needs to be granted. If the install is being performed as a member of the # 144 # group "dba", then that will be used unless specified otherwise below. # 145 # # 146 # The value to be specified for OSDBA and OSOPER group is only for UNIX based # 147 # Operating System. # 148 # # 149 ############################################################################### 150 151 #------------------------------------------------------------------------------ 152 # The DBA_GROUP is the OS group which is to be granted OSDBA privileges. 153 #------------------------------------------------------------------------------ 154 oracle.install.db.DBA_GROUP=dba 155 156 #------------------------------------------------------------------------------ 157 # The OPER_GROUP is the OS group which is to be granted OSOPER privileges. 158 # The value to be specified for OSOPER group is optional. 159 #------------------------------------------------------------------------------ 160 oracle.install.db.OPER_GROUP=oinstall 161 162 #------------------------------------------------------------------------------ 163 # Specify the cluster node names selected during the installation. 164 # Example : oracle.install.db.CLUSTER_NODES=node1,node2 165 #------------------------------------------------------------------------------ 166 oracle.install.db.CLUSTER_NODES= 167 168 #------------------------------------------------------------------------------ 169 # This variable is used to enable or disable RAC One Node install. 170 # 171 # true : Value of RAC One Node service name is used. 172 # false : Value of RAC One Node service name is not used. 173 # 174 # If left blank, it will be assumed to be false 175 #------------------------------------------------------------------------------ 176 oracle.install.db.isRACOneInstall= 177 178 #------------------------------------------------------------------------------ 179 # Specify the name for RAC One Node Service. 180 #------------------------------------------------------------------------------ 181 oracle.install.db.racOneServiceName= 182 183 #------------------------------------------------------------------------------ 184 # Specify the type of database to create. 185 # It can be one of the following: 186 # - GENERAL_PURPOSE/TRANSACTION_PROCESSING 187 # - DATA_WAREHOUSE 188 #------------------------------------------------------------------------------ 189 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE 190 191 #------------------------------------------------------------------------------ 192 # Specify the Starter Database Global Database Name. 193 #------------------------------------------------------------------------------ 194 oracle.install.db.config.starterdb.globalDBName= 195 196 #------------------------------------------------------------------------------ 197 # Specify the Starter Database SID. 198 #------------------------------------------------------------------------------ 199 oracle.install.db.config.starterdb.SID= 200 201 #------------------------------------------------------------------------------ 202 # Specify the Starter Database character set. 203 # 204 # It can be one of the following: 205 # AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2, 206 # EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257, 207 # BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6, 208 # AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8, 209 # IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, 210 # KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950, 211 # ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258 212 #------------------------------------------------------------------------------ 213 oracle.install.db.config.starterdb.characterSet=AL32UTF8 214 215 #------------------------------------------------------------------------------ 216 # This variable should be set to true if Automatic Memory Management 217 # in Database is desired. 218 # If Automatic Memory Management is not desired, and memory allocation 219 # is to be done manually, then set it to false. 220 #------------------------------------------------------------------------------ 221 oracle.install.db.config.starterdb.memoryOption=true 222 223 #------------------------------------------------------------------------------ 224 # Specify the total memory allocation for the database. Value(in MB) should be 225 # at least 256 MB, and should not exceed the total physical memory available 226 # on the system. 227 # Example: oracle.install.db.config.starterdb.memoryLimit=512 228 #------------------------------------------------------------------------------ 229 oracle.install.db.config.starterdb.memoryLimit= 230 231 #------------------------------------------------------------------------------ 232 # This variable controls whether to load Example Schemas onto 233 # the starter database or not. 234 #------------------------------------------------------------------------------ 235 oracle.install.db.config.starterdb.installExampleSchemas=false 236 237 #------------------------------------------------------------------------------ 238 # This variable includes enabling audit settings, configuring password profiles 239 # and revoking some grants to public. These settings are provided by default. 240 # These settings may also be disabled. 241 #------------------------------------------------------------------------------ 242 oracle.install.db.config.starterdb.enableSecuritySettings=true 243 244 ############################################################################### 245 # # 246 # Passwords can be supplied for the following four schemas in the # 247 # starter database: # 248 # SYS # 249 # SYSTEM # 250 # SYSMAN (used by Enterprise Manager) # 251 # DBSNMP (used by Enterprise Manager) # 252 # # 253 # Same password can be used for all accounts (not recommended) # 254 # or different passwords for each account can be provided (recommended) # 255 # # 256 ############################################################################### 257 258 #------------------------------------------------------------------------------ 259 # This variable holds the password that is to be used for all schemas in the 260 # starter database. 261 #------------------------------------------------------------------------------- 262 oracle.install.db.config.starterdb.password.ALL= 263 264 #------------------------------------------------------------------------------- 265 # Specify the SYS password for the starter database. 266 #------------------------------------------------------------------------------- 267 oracle.install.db.config.starterdb.password.SYS= 268 269 #------------------------------------------------------------------------------- 270 # Specify the SYSTEM password for the starter database. 271 #------------------------------------------------------------------------------- 272 oracle.install.db.config.starterdb.password.SYSTEM= 273 274 #------------------------------------------------------------------------------- 275 # Specify the SYSMAN password for the starter database. 276 #------------------------------------------------------------------------------- 277 oracle.install.db.config.starterdb.password.SYSMAN= 278 279 #------------------------------------------------------------------------------- 280 # Specify the DBSNMP password for the starter database. 281 #------------------------------------------------------------------------------- 282 oracle.install.db.config.starterdb.password.DBSNMP= 283 284 #------------------------------------------------------------------------------- 285 # Specify the management option to be selected for the starter database. 286 # It can be one of the following: 287 # 1. GRID_CONTROL 288 # 2. DB_CONTROL 289 #------------------------------------------------------------------------------- 290 oracle.install.db.config.starterdb.control=DB_CONTROL 291 292 #------------------------------------------------------------------------------- 293 # Specify the Management Service to use if Grid Control is selected to manage 294 # the database. 295 #------------------------------------------------------------------------------- 296 oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= 297 298 ############################################################################### 299 # # 300 # SPECIFY BACKUP AND RECOVERY OPTIONS # 301 # ------------------------------------ # 302 # Out-of-box backup and recovery options for the database can be mentioned # 303 # using the entries below. # 304 # # 305 ############################################################################### 306 307 #------------------------------------------------------------------------------ 308 # This variable is to be set to false if automated backup is not required. Else 309 # this can be set to true. 310 #------------------------------------------------------------------------------ 311 oracle.install.db.config.starterdb.automatedBackup.enable=false 312 313 #------------------------------------------------------------------------------ 314 # Regardless of the type of storage that is chosen for backup and recovery, if 315 # automated backups are enabled, a job will be scheduled to run daily to backup 316 # the database. This job will run as the operating system user that is 317 # specified in this variable. 318 #------------------------------------------------------------------------------ 319 oracle.install.db.config.starterdb.automatedBackup.osuid= 320 321 #------------------------------------------------------------------------------- 322 # Regardless of the type of storage that is chosen for backup and recovery, if 323 # automated backups are enabled, a job will be scheduled to run daily to backup 324 # the database. This job will run as the operating system user specified by the 325 # above entry. The following entry stores the password for the above operating 326 # system user. 327 #------------------------------------------------------------------------------- 328 oracle.install.db.config.starterdb.automatedBackup.ospwd= 329 330 #------------------------------------------------------------------------------- 331 # Specify the type of storage to use for the database. 332 # It can be one of the following: 333 # - FILE_SYSTEM_STORAGE 334 # - ASM_STORAGE 335 #------------------------------------------------------------------------------ 336 oracle.install.db.config.starterdb.storageType= 337 338 #------------------------------------------------------------------------------- 339 # Specify the database file location which is a directory for datafiles, control 340 # files, redo logs. 341 # 342 # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 343 #------------------------------------------------------------------------------- 344 oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= 345 346 #------------------------------------------------------------------------------- 347 # Specify the backup and recovery location. 348 # 349 # Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE 350 #------------------------------------------------------------------------------- 351 oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= 352 353 #------------------------------------------------------------------------------- 354 # Specify the existing ASM disk groups to be used for storage. 355 # 356 # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE 357 #------------------------------------------------------------------------------- 358 oracle.install.db.config.asm.diskGroup= 359 360 #------------------------------------------------------------------------------- 361 # Specify the password for ASMSNMP user of the ASM instance. 362 # 363 # Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE 364 #------------------------------------------------------------------------------- 365 oracle.install.db.config.asm.ASMSNMPPassword= 366 367 #------------------------------------------------------------------------------ 368 # Specify the My Oracle Support Account Username. 369 # 370 # Example : MYORACLESUPPORT_USERNAME=abc@oracle.com 371 #------------------------------------------------------------------------------ 372 MYORACLESUPPORT_USERNAME= 373 374 #------------------------------------------------------------------------------ 375 # Specify the My Oracle Support Account Username password. 376 # 377 # Example : MYORACLESUPPORT_PASSWORD=password 378 #------------------------------------------------------------------------------ 379 MYORACLESUPPORT_PASSWORD= 380 381 #------------------------------------------------------------------------------ 382 # Specify whether to enable the user to set the password for 383 # My Oracle Support credentials. The value can be either true or false. 384 # If left blank it will be assumed to be false. 385 # 386 # Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true 387 #------------------------------------------------------------------------------ 388 SECURITY_UPDATES_VIA_MYORACLESUPPORT= 389 390 #------------------------------------------------------------------------------ 391 # Specify whether user doesn't want to configure Security Updates. 392 # The value for this variable should be true if you don't want to configure 393 # Security Updates, false otherwise. 394 # 395 # The value can be either true or false. If left blank it will be assumed 396 # to be false. 397 # 398 # Example : DECLINE_SECURITY_UPDATES=false 399 #------------------------------------------------------------------------------ 400 DECLINE_SECURITY_UPDATES=true 401 402 #------------------------------------------------------------------------------ 403 # Specify the Proxy server name. Length should be greater than zero. 404 # 405 # Example : PROXY_HOST=proxy.domain.com 406 #------------------------------------------------------------------------------ 407 PROXY_HOST= 408 409 #------------------------------------------------------------------------------ 410 # Specify the proxy port number. Should be Numeric and atleast 2 chars. 411 # 412 # Example : PROXY_PORT=25 413 #------------------------------------------------------------------------------ 414 PROXY_PORT= 415 416 #------------------------------------------------------------------------------ 417 # Specify the proxy user name. Leave PROXY_USER and PROXY_PWD 418 # blank if your proxy server requires no authentication. 419 # 420 # Example : PROXY_USER=username 421 #------------------------------------------------------------------------------ 422 PROXY_USER= 423 424 #------------------------------------------------------------------------------ 425 # Specify the proxy password. Leave PROXY_USER and PROXY_PWD 426 # blank if your proxy server requires no authentication. 427 # 428 # Example : PROXY_PWD=password 429 #------------------------------------------------------------------------------ 430 PROXY_PWD= 431 432 #------------------------------------------------------------------------------ 433 # Specify the proxy realm. This value is used if auto-updates option is selected. 434 # 435 # Example : PROXY_REALM=metalink 436 #------------------------------------------------------------------------------ 437 PROXY_REALM= 438 439 #------------------------------------------------------------------------------ 440 # Specify the Oracle Support Hub URL. 441 # 442 # Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/ 443 #------------------------------------------------------------------------------ 444 COLLECTOR_SUPPORTHUB_URL= 445 446 #------------------------------------------------------------------------------ 447 # Specify the auto-updates option. It can be one of the following: 448 # a.MYORACLESUPPORT_DOWNLOAD 449 # b.OFFLINE_UPDATES 450 # c.SKIP_UPDATES 451 #------------------------------------------------------------------------------ 452 oracle.installer.autoupdates.option= 453 #------------------------------------------------------------------------------ 454 # In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where 455 # the updates are to be downloaded. 456 # In case OFFLINE_UPDATES option is chosen, specify the location where the updates 457 # are present. 458 oracle.installer.autoupdates.downloadUpdatesLoc= 459 #------------------------------------------------------------------------------ 460 # Specify the My Oracle Support Account Username which has the patches download privileges 461 # to be used for software updates. 462 # Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com 463 #------------------------------------------------------------------------------ 464 AUTOUPDATES_MYORACLESUPPORT_USERNAME= 465 466 #------------------------------------------------------------------------------ 467 # Specify the My Oracle Support Account Username password which has the patches download privileges 468 # to be used for software updates. 469 # 470 # Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password 471 #------------------------------------------------------------------------------ 472 AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
netca.rsp,如下:
1 ###################################################################### 2 ## Copyright(c) 1998, 2011 Oracle Corporation. All rights reserved. ## 3 ## ## 4 ## Specify values for the variables listed below to customize your ## 5 ## installation. ## 6 ## ## 7 ## Each variable is associated with a comment. The comment ## 8 ## identifies the variable type. ## 9 ## ## 10 ## Please specify the values in the following format: ## 11 ## ## 12 ## Type Example ## 13 ## String "Sample Value" ## 14 ## Boolean True or False ## 15 ## Number 1000 ## 16 ## StringList {"String value 1","String Value 2"} ## 17 ## ## 18 ###################################################################### 19 ## ## 20 ## This sample response file causes the Oracle Net Configuration ## 21 ## Assistant (NetCA) to complete an Oracle Net configuration during ## 22 ## a custom install of the Oracle11g server which is similar to ## 23 ## what would be created by the NetCA during typical Oracle11g ## 24 ## install. It also documents all of the NetCA response file ## 25 ## variables so you can create your own response file to configure ## 26 ## Oracle Net during an install the way you wish. ## 27 ## ## 28 ###################################################################### 29 30 [GENERAL] 31 RESPONSEFILE_VERSION="11.2" 32 CREATE_TYPE="CUSTOM" 33 34 #------------------------------------------------------------------------------- 35 # Name : SHOW_GUI 36 # Datatype : Boolean 37 # Description: This variable controls appearance/suppression of the NetCA GUI, 38 # Pre-req : N/A 39 # Default : TRUE 40 # Note: 41 # This must be set to false in order to run NetCA in silent mode. 42 # This is a substitute of "/silent" flag in the NetCA command line. 43 # The command line flag has precedence over the one in this response file. 44 # This feature is present since 10.1.0.3. 45 #------------------------------------------------------------------------------- 46 SHOW_GUI=false 47 48 #------------------------------------------------------------------------------- 49 # Name : LOG_FILE 50 # Datatype : String 51 # Description: If present, NetCA will log output to this file in addition to the 52 # standard out. 53 # Pre-req : N/A 54 # Default : NONE 55 # Note: 56 # This is a substitute of "/log" in the NetCA command line. 57 # The command line argument has precedence over the one in this response file. 58 # This feature is present since 10.1.0.3. 59 #------------------------------------------------------------------------------- 60 LOG_FILE=""/opt/oracle/product/11.2.0.1/dbhome_1/network/tools/netca.log"" 61 62 [oracle.net.ca] 63 #INSTALLED_COMPONENTS;StringList;list of installed components 64 # The possible values for installed components are: 65 # "net8","server","client","aso", "cman", "javavm" 66 INSTALLED_COMPONENTS={"server","net8","javavm"} 67 68 #INSTALL_TYPE;String;type of install 69 # The possible values for install type are: 70 # "typical","minimal" or "custom" 71 INSTALL_TYPE=""typical"" 72 73 #LISTENER_NUMBER;Number;Number of Listeners 74 # A typical install sets one listener 75 LISTENER_NUMBER=1 76 77 #LISTENER_NAMES;StringList;list of listener names 78 # The values for listener are: 79 # "LISTENER","LISTENER1","LISTENER2","LISTENER3", ... 80 # A typical install sets only "LISTENER" 81 LISTENER_NAMES={"LISTENER"} 82 83 #LISTENER_PROTOCOLS;StringList;list of listener addresses (protocols and parameters separated by semicolons) 84 # The possible values for listener protocols are: 85 # "TCP;1521","TCPS;2484","NMP;ORAPIPE","IPC;IPCKEY","VI;1521" 86 # A typical install sets only "TCP;1521" 87 LISTENER_PROTOCOLS={"TCP;1521"} 88 89 #LISTENER_START;String;name of the listener to start, in double quotes 90 LISTENER_START=""LISTENER"" 91 92 #NAMING_METHODS;StringList;list of naming methods 93 # The possible values for naming methods are: 94 # LDAP, TNSNAMES, ONAMES, HOSTNAME, NOVELL, NIS, DCE 95 # A typical install sets only: "TNSNAMES","ONAMES","HOSTNAMES" 96 # or "LDAP","TNSNAMES","ONAMES","HOSTNAMES" for LDAP 97 NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} 98 99 #NOVELL_NAMECONTEXT;String;Novell Directory Service name context, in double quotes 100 # A typical install does not use this variable. 101 #NOVELL_NAMECONTEXT = ""NAMCONTEXT"" 102 103 #SUN_METAMAP;String; SUN meta map, in double quotes 104 # A typical install does not use this variable. 105 #SUN_METAMAP = ""MAP"" 106 107 #DCE_CELLNAME;String;DCE cell name, in double quotes 108 # A typical install does not use this variable. 109 #DCE_CELLNAME = ""CELL"" 110 111 #NSN_NUMBER;Number;Number of NetService Names 112 # A typical install sets one net service name 113 NSN_NUMBER=1 114 115 #NSN_NAMES;StringList;list of Net Service names 116 # A typical install sets net service name to "EXTPROC_CONNECTION_DATA" 117 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} 118 119 #NSN_SERVICE;StringList;Oracle11g database's service name 120 # A typical install sets Oracle11g database's service name to "PLSExtProc" 121 NSN_SERVICE={"PLSExtProc"} 122 123 #NSN_PROTOCOLS;StringList;list of coma separated strings of Net Service Name protocol parameters 124 # The possible values for net service name protocol parameters are: 125 # "TCP;HOSTNAME;1521","TCPS;HOSTNAME;2484","NMP;COMPUTERNAME;ORAPIPE","VI;HOSTNAME;1521","IPC;IPCKEY" 126 # A typical install sets parameters to "IPC;EXTPROC" 127 NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
dbca.rsp 文件内容如下:
View Code
build.sh 如下:
#!/bin/bash # ################## # # BUILDING THE IMAGE # # ################## # IMAGE_NAME=oracle11:v0.1 echo "Building image '$IMAGE_NAME' ..." # BUILD THE IMAGE (replace all environment variables) BUILD_START=$(date '+%s') echo $BUILD_START docker build -t $IMAGE_NAME -f Dockerfile-oracle11g.ee . || { echo "" echo "ERROR: Oracle Database Docker Image was NOT successfully created." echo "ERROR: Check the output and correct any reported problems with the docker build operation." exit 1 } echo "" BUILD_END=$(date '+%s') BUILD_ELAPSED=`expr $BUILD_END - $BUILD_START` echo $BUILD_ELAPSED
sh build.sh 执行完后,编译完镜像,开始创建容器
1 docker run -d -p 10022:22 -p 49181:1521 -v /home/docker/dockerdata/11.2.0.1/oradata:/opt/oracle/oradata --privileged=true --name test oracle11:v0.1
需要注意的是,宿主目录需要提前建立 /home/docker/dockerdata/11.2.0.1/oradata。
使用xshell远程连接上容器机器,用户名:oracle,密码:oracle,oracle用户登录之后,执行$HOME目录下的 runOracle.sh 脚本,sh runOracle.sh test ,参数为需要建立数据库的名字。
会得到类似如下的输出:
1 sed: can't read /opt/oracle/product/11.2.0.1/dbhome_1/network/admin/listener.ora: No such file or directory 2 3 LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 12-JUN-2018 08:03:51 4 5 Copyright (c) 1991, 2011, Oracle. All rights reserved. 6 7 Starting /opt/oracle/product/11.2.0.1/dbhome_1/bin/tnslsnr: please wait... 8 9 TNSLSNR for Linux: Version 11.2.0.3.0 - Production 10 Log messages written to /opt/oracle/diag/tnslsnr/ce9412e660a0/listener/alert/log.xml 11 Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ce9412e660a0)(PORT=1521))) 12 13 Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) 14 STATUS of the LISTENER 15 ------------------------ 16 Alias LISTENER 17 Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production 18 Start Date 12-JUN-2018 08:03:51 19 Uptime 0 days 0 hr. 0 min. 0 sec 20 Trace Level off 21 Security ON: Local OS Authentication 22 SNMP OFF 23 Listener Log File /opt/oracle/diag/tnslsnr/ce9412e660a0/listener/alert/log.xml 24 Listening Endpoints Summary... 25 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ce9412e660a0)(PORT=1521))) 26 The listener supports no services 27 The command completed successfully 28 /bin/cat: /proc/sys/net/core/wmem_default: No such file or directory 29 /bin/cat: /proc/sys/net/core/wmem_default: No such file or directory 30 /bin/cat: /proc/sys/net/core/wmem_default: No such file or directory 31 Copying database files 32 1% complete 33 3% complete 34 11% complete 35 18% complete 36 26% complete 37 37% complete 38 Creating and starting Oracle instance 39 40% complete 40 45% complete 41 50% complete 42 55% complete 43 56% complete 44 60% complete 45 62% complete 46 Completing Database Creation 47 66% complete 48 70% complete 49 73% complete 50 85% complete 51 96% complete 52 100% complete 53 Look at the log file "/opt/oracle/cfgtoollogs/dbca/test/test.log" for further details.
相关文件可以在 https://github.com/li936393/docker-oracle-11.2.0.1上找到
每天进步一点点