Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
oracle_multitenant_overview [2021/11/13 17:28] – [Management] andonovj | oracle_multitenant_overview [2021/11/13 21:51] (current) – andonovj | ||
---|---|---|---|
Line 13: | Line 13: | ||
* Application Container - Container which consist of 1 or many PDBs which host a specific application. We are able to assign versions and name to such container, furthermore we can initiate installation and upgrade modes. | * Application Container - Container which consist of 1 or many PDBs which host a specific application. We are able to assign versions and name to such container, furthermore we can initiate installation and upgrade modes. | ||
- | =====Creation===== | + | ===== Using SQL ===== |
Firstly, we need to create our container. From 12c, we can create a database to be either as it always has been, a normal database, OR we can create it to allow other databases as well. So it will be a container, let's see how we can do both: | Firstly, we need to create our container. From 12c, we can create a database to be either as it always has been, a normal database, OR we can create it to allow other databases as well. So it will be a container, let's see how we can do both: | ||
- | ==== Create Normal DB === | + | ==== Creation |
Actually, the creation of a normal database isn't that hard, you can just type: | Actually, the creation of a normal database isn't that hard, you can just type: | ||
Line 94: | Line 94: | ||
Furthermore, | Furthermore, | ||
+ | ===== Using DBCA ===== | ||
+ | We can use DBCA to create and delete CDB and PDBs as follows: | ||
+ | < | ||
+ | # Local container (cdb1). | ||
+ | dbca -silent -createDatabase \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | # Remote container (cdb3) with PDB (pdb5). | ||
+ | dbca -silent -createDatabase \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | # Non-CDB instance (db12c). | ||
+ | dbca -silent -createDatabase \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | # Delete the instances. | ||
+ | #dbca -silent -deleteDatabase -sourceDB cdb1 -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
+ | dbca -silent -deleteDatabase -sourceDB cdb3 -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
+ | dbca -silent -deleteDatabase -sourceDB db12c -sysDBAUserName sys -sysDBAPassword SysPassword1 | ||
+ | |||
+ | #Configure OMF | ||
+ | export ORAENV_ASK=NO | ||
+ | export ORACLE_SID=cdb3 | ||
+ | . oraenv | ||
+ | export ORAENV_ASK=YES | ||
+ | |||
+ | sqlplus / as sysdba <<EOF | ||
+ | |||
+ | ALTER SYSTEM SET db_create_file_dest = '/ | ||
+ | |||
+ | SHUTDOWN IMMEDIATE; | ||
+ | STARTUP MOUNT; | ||
+ | ALTER DATABASE ARCHIVELOG; | ||
+ | ALTER DATABASE OPEN; | ||
+ | |||
+ | ALTER PLUGGABLE DATABASE pdb5 OPEN; | ||
+ | ALTER PLUGGABLE DATABASE pdb5 SAVE STATE; | ||
+ | |||
+ | EXIT; | ||
+ | EOF | ||
+ | </ | ||
+ | |||
+ | ===== Automation ===== | ||
+ | Using the awesome power, vested to me by Vagrant and Bash, I summon the automation of: | ||
+ | |||
+ | * Virtual Machine | ||
+ | * Oracle 19c database | ||
+ | * 1 CDB | ||
+ | * 1 PDB | ||
+ | |||
+ | All that, twice: | ||
+ | |||
+ | |||
+ | < | ||
+ | $allow_shell = << | ||
+ | sed -i ' | ||
+ | systemctl restart sshd.service | ||
+ | SCRIPT | ||
+ | |||
+ | $edit_hosts_file = << | ||
+ | cat > /etc/hosts <<EOF | ||
+ | 127.0.0.1 localhost | ||
+ | 192.168.0.l03 lpar1.example.com | ||
+ | 192.168.0.l04 lpar2.example.com | ||
+ | EOF | ||
+ | SCRIPT | ||
+ | |||
+ | $install_oracle_preinstall = << | ||
+ | curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm https:// | ||
+ | yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm | ||
+ | SCRIPT | ||
+ | |||
+ | $install_oracle_19c = << | ||
+ | cd /vagrant | ||
+ | yum -y localinstall oracle-database-ee-19c-1.0-1.x86_64.rpm | ||
+ | |||
+ | SCRIPT | ||
+ | |||
+ | $install_19c_db = << | ||
+ | runuser -l oracle -c '/ | ||
+ | SCRIPT | ||
+ | |||
+ | $install_vnc_server = << | ||
+ | yum -y install vnc-server | ||
+ | yum -y install tigervnc-server | ||
+ | yum -y install xterm | ||
+ | yum -y install net-tools | ||
+ | yum -y install unzip | ||
+ | yum -y install curl | ||
+ | SCRIPT | ||
+ | |||
+ | |||
+ | Vagrant.configure(" | ||
+ | | ||
+ | config.vm.provision :shell, inline: " | ||
+ | config.vm.define " | ||
+ | lpar.vm.box = " | ||
+ | lpar.vm.hostname = " | ||
+ | lpar.vm.synced_folder " | ||
+ | lpar.vm.network " | ||
+ | lpar.vm.network " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provision " | ||
+ | lpar.vm.provider :virtualbox do |v| | ||
+ | v.customize [" | ||
+ | v.customize [" | ||
+ | v.customize [" | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | |||
+ | Just make sure, you have the Oracle 19c RPM in folder called: " | ||
+ | |||
+ | < | ||
+ | responseFileVersion=/ | ||
+ | gdbName=orcl.example.com | ||
+ | sid=orcl | ||
+ | databaseConfigType=SI | ||
+ | policyManaged=false | ||
+ | createServerPool=false | ||
+ | force=false | ||
+ | createAsContainerDatabase=true | ||
+ | numberOfPDBs=1 | ||
+ | pdbName=pdb1 | ||
+ | useLocalUndoForPDBs=true | ||
+ | pdbAdminPassword=Oracle123 | ||
+ | templateName=/ | ||
+ | sysPassword=Oracle123 | ||
+ | systemPassword= Oracle123 | ||
+ | emExpressPort=0 | ||
+ | runCVUChecks=FALSE | ||
+ | dvConfiguration=false | ||
+ | olsConfiguration=false | ||
+ | datafileJarLocation={ORACLE_HOME}/ | ||
+ | datafileDestination={ORACLE_BASE}/ | ||
+ | recoveryAreaDestination={ORACLE_BASE}/ | ||
+ | storageType=FS | ||
+ | characterSet=AL32UTF8 | ||
+ | registerWithDirService=false | ||
+ | variables=ORACLE_BASE_HOME=/ | ||
+ | initParams=undo_tablespace=UNDOTBS1, | ||
+ | sampleSchema=false | ||
+ | memoryPercentage=40 | ||
+ | databaseType=MULTIPURPOSE | ||
+ | automaticMemoryManagement=true | ||
+ | totalMemory=0 | ||
+ | </ | ||
+ | |||
+ | Of course feel free to add / remove or modify any parameter which you wish. Just bare in mind that some are mandatory :) |