Skip to content

Instantly share code, notes, and snippets.

View Tracnac's full-sized avatar

Tracnac

View GitHub Profile
@Tracnac
Tracnac / Change OCR location.md
Last active October 19, 2022 11:54
Change OCR location #oracle #cluster

Change OCR location :

Under root :

cd $GRID_HOME
./ocrcheck
./ocrconfig -add +NEW_DG
./ocrconfig -delete +OLD_DG
@Tracnac
Tracnac / Contention and Enqueues.md
Last active October 19, 2022 11:52
Contention and Enqueues #oracle #sql
select distinct
u.username,
u.osuser,
w.event,
w.p2text as reason,
ts.name as tablespace,
nvl(ddf.file_name, dtf.file_name)
from
v$session_wait w,
@Tracnac
Tracnac / Convert cdr to iso.md
Created October 19, 2022 11:51
Convert cdr to iso #osx #apple

makehybrid -iso -joliet -o output.iso input.cdr

@Tracnac
Tracnac / Creating ASM for test purposes in the file system.md
Created October 19, 2022 11:51
Creating ASM for test purposes in the file system #oracle #cluster

#Shell #Oracle

Creating ASM for test purposes in the file system By Mike Dietrich on Dec 21, 2012

First of all, I'm back after pausing for a while - sorry for not updating the blog in the past weeks ... and you won't see many updates in the following weeks as it'll be holiday season (and we Germans have sooooo many public holidays)

Anyway, back to tech topics. Today I want to test Oracle Restart upgrades. Oracle Restartinternally is called SIHA (Single Instance High Availability) which explains the topic a bit more. Basically it means having your database reside in ASM and let Oracle Clusterware take care on it, even though you don't have a cluster. Not a bad idea as this can be very helpful in real world environments. But I did realize that the entire process is not documented in all details. So I'd thought I should give this a try.

@Tracnac
Tracnac / CRS Dump and Update.md
Last active October 19, 2022 11:49
CRS Dump and Update #oracle #cluster
  1. Get the name of the VIP resource you want to update. eg ora.node1.vip and stop the resource.
  2. create the profile crs_stat -p ora.node1.vip > $HOME/ora.node1.vip.cap
  3. Update the value of HOSTING_MEMBERS parameter in the .cap file. Most probably it will have node1 in the value.
  4. Include node2 in the HOSTING_MEMBERS parameter separated by , eg. HOSTIMG_MEMBERS=node1,node2
  5. Update parameter PLACEMENT=favored in the .cap file.
  6. crs_register ora.node1.vip -dir -u
@Tracnac
Tracnac / CRS Endpoint.md
Last active October 19, 2022 11:48
CRS Endpoint #oracle #cluster
crsctl modify resource ora.LISTENER_SUPERVISOR.lsnr -attr "PORT="
crsctl modify resource ora.LISTENER_SUPERVISOR.lsnr -attr "ENDPOINTS="
@Tracnac
Tracnac / Dataguard.md
Created October 19, 2022 11:47
Dataguard #oracle #sql
select /*+ RULE */ * from (
SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference"
FROM
(SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH,
(SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE ARCH.THREAD# = APPL.THREAD#)

with ARCH as
(SELECT /*+ MATERIALIZE */ THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)),
@Tracnac
Tracnac / DBMS_SPACE.SPACE_USAGE.md
Last active October 19, 2022 11:47
DBMS_SPACE.SPACE_USAGE #oracle #sql
set serveroutput on


variable unf number
variable unfb number
variable fs1 number
variable fs1b number
variable fs2 number
variable fs2b number
@Tracnac
Tracnac / Debug EXPDP.md
Created October 19, 2022 11:44
Debug EXPDP #oracle #sql
col username format a10
set linesize 150
col job_name format a20
col program format a25
SELECT TO_CHAR (SYSDATE, 'YYYY-MM-DD HH24:MI:SS'),
s.program,
s.sid,
s.serial#
s.status,
@Tracnac
Tracnac / Ecrire dans la log oracle.md
Created October 19, 2022 11:44
Ecrire dans la log oracle #oracle #sql
exec dbms_system.ksdddt; -- Timestamp
exec dbms_system.ksdwrt(3, 'Coucou le hibou');
exec dbms_system.ksdfls; -- Flush