exec sys.dbms_system.ksdwrt(2,'Your message here')The first argument can be either
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
Monday, December 11, 2023
How to write custom messages to the alert log file
Friday, December 8, 2023
Syntax for applying and removing a patch on the WLS server Home in an EBS 12.2 installation
The bsu (or "Smart update") utility:
cd $MW_HOME/utils/bsu bsu.sh -version Oracle Smart Update. Version: 3.3.0.0Here's an example on how to install a patch:
./bsu.sh -remove -patch_download_dir=$MW_HOME/utils/bsu/cache_dir -patchlist=1LRI -prod_dir=$MW_HOME/wlserver_10.3 -verbose -log=install_1LRI.logHere's an example on how to remove a patch:
./bsu.sh -install -patch_download_dir=$MW_HOME/utils/bsu/cache_dir -patchlist=E7HI -prod_dir=$MW_HOME/wlserver_10.3 -verbose -log=install_E7HI.log
Script sniplet to differentiate between cdb and pdb environment settings in a shell script
This little sniplet could be used if you find yourself in a situation where you need to differentiate between the cdb environment and the pdb environment on a server using multitenant setup.
I am setting a commonly used alias for the usage of sqlplus called "sql" depending on the ORACLE_SID being set to the cdb or the pdb.
It differs slightly since I you can only do a bequath session when connecting to the former, and not the latter:
When connecting to the pdb as sysdba, you need to go through the listener, and therefore supply the password.
When connecting to the cdb you can do a so called bequeath session and connect directly to the oracle instance through IPC.
I am setting a commonly used alias for the usage of sqlplus called "sql" depending on the ORACLE_SID being set to the cdb or the pdb.
It differs slightly since I you can only do a bequath session when connecting to the former, and not the latter:
read -p 'Will you be administrating the cdb or the PDB? ' container case $container in CDB|cdb) . $ORACLE_HOME/cdb_settings.env; alias sql='sqlplus / as sysdba';; PDB1|pdb1) . $ORACLE_HOME/pdb1.env; alias sql='sqlplus sys@pdb1 as sysdba';; *) echo "You must select cdb or pdb1"; exit 1;; esac
How to generate a cold backup script for a database
Probably many ways to to this, but here is how I generated a simple file that after being made executable will copy all files to a specific folder.
The database must be shut down before running the script, so in other words, this will be a good, old-fashioned cold backup!
set lines 200 set pages 0 set trimspool on set heading off set echo off set feedback off set verify off spool cp_files.sh SELECT 'cp ' || a.file_name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.file_name, ( INSTR (b.file_name, '/', -1, 1) + 1))) FROM cdb_data_files b WHERE a.file_name = b.file_name) FROM cdb_data_files a UNION SELECT 'cp ' || a.MEMBER || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.MEMBER, ( INSTR (b.MEMBER, '/', -1, 1) + 1))) FROM v$logfile b WHERE a.MEMBER = b.MEMBER) FROM v$logfile A UNION SELECT 'cp ' || a.name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.name, ( INSTR (b.name, '/', -1, 1) + 1))) FROM v$tempfile b WHERE a.name = b.name) FROM v$tempfile a UNION SELECT 'cp ' || a.name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.name, ( INSTR (b.name, '/', -1, 1) + 1))) FROM v$controlfile b WHERE a.name = b.name) FROM v$controlfile a;
Subscribe to:
Posts (Atom)