$ find . -iname "*.mp3" -print0 | xargs -0 -I mp3file mplayer mp3file
Tuesday, 25 September 2012
Loop xargs
Connect to iscsi disk debian
List device
iscsiadm -m discovery -t st -p 192.168.42.236
192.168.42.236:3260,1 iqn.2012-08.sc-nas-004.istgt:disk1
Connect:
iscsiadm -m discovery -t st -p 192.168.42.236 "iqn.2012-08.sc-nas-004.istgt:disk2" --portal "192.168.42.236:3260" --login
iscsiadm -m discovery -t st -p 192.168.42.236
192.168.42.236:3260,1 iqn.2012-08.sc-nas-004.istgt:disk1
Connect:
iscsiadm -m discovery -t st -p 192.168.42.236 "iqn.2012-08.sc-nas-004.istgt:disk2" --portal "192.168.42.236:3260" --login
Monday, 24 September 2012
Oracle EM repository recreate
emca -repos recreate
emca -config dbcontrol db
change ports
emca -reconfig ports -dbcontrol_http_port 1158
emca -config dbcontrol db
change ports
emca -reconfig ports -dbcontrol_http_port 1158
Recreate controlfile - change oracle database sid
From sqlplus
alter database backup controlfile to trace;
From trace (trace location you can find in alert_log)
#change reuse to set and remove controlfile
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "DM02DEV" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/data/s_ora01dmdev/oradata/dm02dev/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/data/s_ora01dmdev/oradata/dm02dev/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/data/s_ora01dmdev/oradata/dm02dev/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/data/s_ora01dmdev/oradata/dm02dev/system01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/sysaux01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/undotbs01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/users01.dbf'
CHARACTER SET AL32UTF8
;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/data/s_ora01dmdev/oradata/dm02dev/temp01.dbf'
SIZE 39845888 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
alter database backup controlfile to trace;
From trace (trace location you can find in alert_log)
#change reuse to set and remove controlfile
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "DM02DEV" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/data/s_ora01dmdev/oradata/dm02dev/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/data/s_ora01dmdev/oradata/dm02dev/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/data/s_ora01dmdev/oradata/dm02dev/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/data/s_ora01dmdev/oradata/dm02dev/system01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/sysaux01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/undotbs01.dbf',
'/data/s_ora01dmdev/oradata/dm02dev/users01.dbf'
CHARACTER SET AL32UTF8
;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/data/s_ora01dmdev/oradata/dm02dev/temp01.dbf'
SIZE 39845888 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
Rman backup script
#!/bin/bash
export ORACLE_SID=orcl_1
export ORACLE_BASE=/u01/app/oracle
export PATH=/u01/app/oracle/database/product/11.2.0/dbhome_1/bin:/u01/app/11.2.0/grid/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
export ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
basedir=/u01/app/oracle/backup
host=`hostname`
backup_dir=`date '+%Y.%m.%d'`
filename=`date '+%Y.%m.%d_%H.%M.%S'`
test -d ${basedir}/${host}/${backup_dir} || mkdir -p ${basedir}/${host}/${backup_dir}
if [ "x$1" = "x0" -o "x$1" = "x1" ]; then
inclevel=$1
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level ${inclevel} database format '${basedir}/${host}/${backup_dir}/data_lv${inclevel}_${filename}.%U';
backup as compressed backupset archivelog all delete all input format '${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format '${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
else
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup as compressed backupset archivelog all delete all input format '${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format '${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
fi
export ORACLE_SID=orcl_1
export ORACLE_BASE=/u01/app/oracle
export PATH=/u01/app/oracle/database/product/11.2.0/dbhome_1/bin:/u01/app/11.2.0/grid/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
export ORACLE_HOME=/u01/app/oracle/database/product/11.2.0/dbhome_1
basedir=/u01/app/oracle/backup
host=`hostname`
backup_dir=`date '+%Y.%m.%d'`
filename=`date '+%Y.%m.%d_%H.%M.%S'`
test -d ${basedir}/${host}/${backup_dir} || mkdir -p ${basedir}/${host}/${backup_dir}
if [ "x$1" = "x0" -o "x$1" = "x1" ]; then
inclevel=$1
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level ${inclevel} database format '${basedir}/${host}/${backup_dir}/data_lv${inclevel}_${filename}.%U';
backup as compressed backupset archivelog all delete all input format '${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format '${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
else
rman target / log=${basedir}/${host}/${backup_dir}/backup_${filename}.log << !
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
backup as compressed backupset archivelog all delete all input format '${basedir}/${host}/${backup_dir}/arch_${filename}.%U';
backup as compressed backupset current controlfile format '${basedir}/${host}/${backup_dir}/control_${filename}.%U';
backup spfile format '${basedir}/${host}/${backup_dir}/spfile_${filename}.%U';
delete noprompt obsolete recovery window of 7 days;
}
!
fi
Size oracle object in system schema
select owner,segment_name,segment_type
,bytes/(1024*1024) size_m
from dba_segments
where tablespace_name = 'SYSTEM'
and bytes/(1024*1024) >1
order by size_m desc;
Subscribe to:
Posts (Atom)