Posts

Showing posts from 2008

tar Over ssh

On regular basis, we encounter the need to copy a whole directory between two hosts. Usually we do it when we clone oracle application software.
Each time I am looking for the right syntax … :( NO MORE !!!
tar cvf‎ – source_dir/ | ssh target_host "cd `pwd`;tar xvf‎ -"
This one will copy source_dir to‎ target_host
For slow connection‎:
tar cvf‎ – source_dir/ | gzip -c‎ | ssh target_host "cd `pwd`;gunzip -c|tar xvf‎ -"
You will enter password once‎ (probably‎)

switching database to archivelog mode

switch the database to archivelog mode.
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
switch database to noarchivelog mode.
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database noarchivelog;
SQL> alter database open;

trcsess utility

The trcsess utility consolidates trace output from selected trace files based on several criteria:

trcsess &nbsp[output=output_file_name]
        &nbsp[session=session_id]
        &nbsp[clientid=client_id]
        &nbsp[service=service_name]
        &nbsp[action=action_name]
        &nbsp[module=module_name]
        &nbsp[trace_files]
trcsess output=main.trc service=psdwh *trc
After the consolidate trace file had been generated you can execute tkprof on it.
For example:
tkprof main.trc main.prf sys=no sort=exeela
TKPROF: Release 10.2.0.3.0 - Production on Thu Feb 28 13:38:23 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
for more information:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm

Disk Structure Command for ASM - asmdisks

In my firm we have a seperation between System guys to the DBAs, we don't have root privileges. this is the reason that they are peparing us the ASM disks.
After using "/etc/init.d/oracleasm createdisk..." I tailored a script to see all the information that I can get WITHOUT the need to connect to the ASM instance.
#!/bin/ksh

export ORACLE_HOME=`grep ASM /etc/oratab | cut -d: -f2`
export PATH=$PATH:~$user/dba/scripts/bin:$ORACLE_HOME/bin
export SID=`grep ASM /etc/oratab | cut -d: -f1`

printf "\n%-15s %-14s %-11s %s\n" "ASM disk" "based on" "Minor,Major" "Size (Mb)"
printf "%-15s %-14s %-11s %s\n" "===============" "=============" "===========" "========="
for i in `/etc/init.d/oracleasm listdisks`
do
v_asmdisk=`/etc/init.d/oracleasm querydisk $i | awk '{print $2}' | sed 's/\"//g'`
v_minor=`/etc/init.d/oracleasm querydisk $i | awk -F[ '{print $2}' | awk -F…