Format for JDBC URL with SID:
•jdbc:oracle:thin:@host:1521:sid
•jdbc:oracle:thin:user/password@host:1521:sid
Format for JDBC URL with Service Name:
•jdbc:oracle:thin:@//host:1521/servicename
•jdbc:oracle:thin:user/password@//host:1521/servicename
The difference is in the use of slashes (/) and colons (:)
Source: Oracle Documentation, note 832455.1
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.
Thursday, May 21, 2015
Wednesday, May 20, 2015
How to deinstall Oracle 10g database software
How to deinstall Oracle 10g database software
In oracle 10g, you need to use the oui (oracle universal installer) script supplied in the $ORACLE_HOME/oui/bin folder, as shown below.
# Log in as the oracle 10g user, and set the environment to the ORACLE_HOME you are about remove.
# Check the current ORACLE_HOME
echo $ORACLE_HOME
/u01/oracle/product/10.2.0.4/db
# run oui in silent mode, and point to the correct Oracle 10g home:
Expected output:
There should be a row similar to:
Remove the old ORACLE_HOME folder physically from disk:
In oracle 10g, you need to use the oui (oracle universal installer) script supplied in the $ORACLE_HOME/oui/bin folder, as shown below.
# Log in as the oracle 10g user, and set the environment to the ORACLE_HOME you are about remove.
# Check the current ORACLE_HOME
echo $ORACLE_HOME
/u01/oracle/product/10.2.0.4/db
# run oui in silent mode, and point to the correct Oracle 10g home:
cd /u01/oracle/product/10.2.0.4/db/oui/bin
./runInstaller -deinstall -silent REMOVE_HOMES={"/u01/oracle/product/10.2.0.4/db"}
./runInstaller -deinstall -silent REMOVE_HOMES={"/u01/oracle/product/10.2.0.4/db"}
Expected output:
Starting Oracle Universal Installer... No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-05-20_08-51-59AM. Please wait ... Oracle Universal Installer, Version 10.2.0.4.0 Production Copyright (C) 1999, 2008, Oracle. All rights reserved. Starting deinstall Deinstall in progress (Wednesday, May 20, 2015 8:52:24 AM CEST) Configuration assistant "iSQL*Plus Configuration Assistant" succeeded Configuration assistant "Oracle Database Configuration Assistant" succeeded Configuration assistant "Oracle Net Configuration Assistant - Deinstall Script" failed ............................................................................................................... 100% Done. Deinstall successful End of install phases.(Wednesday, May 20, 2015 8:56:17 AM CEST) End of deinstallations Please check '/u01/oracle/oraInventory/logs/silentInstall2015-05-20_08-51-59AM.log' for more details.To verify the deinstallation, check the oracle inventory, in my case /u01/oracle/oraInventory/ContentsXML/inventory.xml
There should be a row similar to:
Remove the old ORACLE_HOME folder physically from disk:
cd /u01/oracle/product rm -rf 10.2.0.4
How to deinstall Oracle 11g database software
In oracle 11g, you can use the deinstall script supplied in the $ORACLE_HOME/deinstall folder, as shown below.
In my example, I have two Oracle software installations on the host
/u01/oracle/product/11203 <-- not in use, can be removed
/u01/oracle/product/11204 <-- in use
I have found that when you have a listener running on the host out of a different ORACLE_HOME, the deinstall script will often (but not always) want to deconfigure it, despite the fact that it runs out of a different ORACLE_HOME. So for a brief period, the host may be without a valid listener process. However, this was never a problem , simply change directory to the working /u01/oracle/product/11204/network/admin folder and restart the listener.
Sometimes (but not always) you may have to manually remove the deinstall folder under the ORACLE_HOME home you just deinstalled.
In my example, I have two Oracle software installations on the host
cd /tmp
# first perform a trial run
/u01/oracle/product/11203/deinstall/deinstall -checkonly
# do the actual deinstall
/u01/oracle/product/11203/deinstall/deinstall
I have found that when you have a listener running on the host out of a different ORACLE_HOME, the deinstall script will often (but not always) want to deconfigure it, despite the fact that it runs out of a different ORACLE_HOME. So for a brief period, the host may be without a valid listener process. However, this was never a problem , simply change directory to the working /u01/oracle/product/11204/network/admin folder and restart the listener.
Sometimes (but not always) you may have to manually remove the deinstall folder under the ORACLE_HOME home you just deinstalled.
Thursday, May 7, 2015
How to add a logfile group and a logfile member - syntax
alter database add logfile group 2 ( '/u01/app/oracle/flash_recovery_area/mydb/onlinelog/redo02a.log', '/u01/app/oracle/oradata/mydb/onlinelog/redo02b.log' ) size 50M;
Remember, if you have just recently dropped the redo log members, they are still present physically on disk.
If you'd like to reuse the log file member names, and to avoid
ORA-00301: error in adding log file /u03/oradata/arutvt/redo03.log - file cannot be created,
add the REUSE keyword at the end of the statement:
alter database add logfile group 3 ('/u03/oradata/mydb/redo03.log') size 1024M REUSE;To add another member to an already existing group:
ALTER DATABASE ADD LOGFILE MEMBER '/u03/oradata/mydb/redo03.log' TO GROUP 3;If the redo log file member is already present on disk, use reuse:
ALTER DATABASE ADD LOGFILE MEMBER '/u03/oradata/mydb/redo3b.log' REUSE TO GROUP 3;
If you do not specifically say which log group number you want to create, Oracle will take add another group based on the largest log file group number in v$logfile. So if I have 3 groups already, and execute
alter database add logfile '/rdodata/mydb/redo04.log' size 2048M;It will create group number 4 for you, even if you do not explicitly say so:
SYS@cdb>SQL>@redo GROUP# MEMBER MB ARC STATUS SEQUENCE# ---------- -------------------------------------------------- ---------- --- ---------------- ---------- 1 /rdodata/mydbredo01.log 2048 YES INACTIVE 220 2 /rdodata/mydb/redo02.log 2048 YES INACTIVE 221 3 /rdodata/mydb/redo03.log 2048 NO CURRENT 222 4 /rdodata/mydb/redo04.log 2048 YES UNUSED 0
Documentation for Oracle 19c is found here
Thursday, April 30, 2015
How to find information about CPUs on a Linux server
On RHEL-based Linux distributions, cat the file /proc/cpuinfo, and you will find detailed information about the server's CPUs, including model name, cache size and vendor.
Or
cat /proc/cpuinfo | grep processor processor : 0 processor : 1 processor : 2 processor : 3
Or
lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 4 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 58 Stepping: 0 CPU MHz: 2800.000 BogoMIPS: 5600.00 Hypervisor vendor: VMware Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 25600K NUMA node0 CPU(s): 0-3
Wednesday, April 29, 2015
How to execute a stored dbms_scheduler job
In sqlplus, execute the following:
execute dbms_scheduler.run_job('CHANGE_PERMS',TRUE);
Friday, April 24, 2015
How to select rows from a specific partition
The syntax to use if you want to select directly from a specific partition:
SELECT row1, row2 ... FROM my_partitioned_table PARTITION (my_partition_name) WHERE ....;
From a subpartition:
SELECT row1, row2 ... FROM my_partitioned_table SUBPARTITION (my_subpartition_name) WHERE ....;
With Oracle 11g interval partitioning, the syntax has changed so that you can reference a date range, rather than a partition name, since the auto generated names won't say anything meaningful about their content:
select row1, row2 .. from my_partitioned_table PARTITION FOR (to_date('25-FEB-2015','dd-mon-yyyy'));
Remember that aliases must be specified after the entire FROM-clause, including the PARTITION-part, like this:
select ee.col1 from my_partitioned_table partition (SYS_P2447) ee where ee.col2 = 'string1' and ee.col3 like '%string2%' order by ee.col1,col2;
If you place the alias immediately after the table name, you'll get the error:
partition (SYS_P2447) * ERROR at line 3: ORA-00924: missing BY keywordupon execution.
Subscribe to:
Posts (Atom)