Monday, July 7, 2014

Change Monitor resolution from terminal

Problem:
default resolution is not support by my moniter. There is black screen on the monitor but remote ssh login is available.

Solution:

1. check /var/log/xorg.0.log to find out monitor name and allowed resolution. or run command to findout

[root@test log]# xrandr -d :0
Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-0 disconnected (normal left inverted right x axis y axis)
VGA-0 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 384mm x 306mm
   1280x1024      56.3*+   60.0
   1280x960       60.0
   1152x864       75.0
   1024x768       75.1     70.1     60.0
   832x624        74.6
   800x600        72.2     75.0     60.3     56.2
   640x480        72.8     75.0     66.7     60.0
   720x400        70.1



2. change resolution with command from termial

  xrandr -d :0 --output VGA-0 --mode 1152x864

reference:
http://askubuntu.com/questions/405645/how-to-enable-monitor-from-terminal

Thursday, June 26, 2014

Generate multiple files using each line of a file in Linux

ISSUE:

Sometimes a file or a command need be used against to a list of servers or databases. So a general file or command need be generated with specific information as a general pattern such as database name.

SOLUTION:

A simple While statement can do this task.  So general while statement is provided for easy access

Statement:

while read line
do
host_name=`echo $line | cut -d ' ' -f 1` #get first field of input line
host_ip=`echo $line | cut -d ' ' -f 2`       # get second field of input line
short_hname=${host_name%%\.*}      # remove domain port of hostname
alias_hname=${short_hname:9:5}        # extract 5 character starting at 9 as alias name
if [ ${short_hname:0:3} == "tet" ] ; then # extract 3 character to setup environment name
env_name=test
else
env_name=${short_hname:4:3}
fi
echo "sshpass -e ssh -o StrictHostKeyChecking=no test@$host_ip" > ${env_name}_${alias_hname}_${short_hname}.sh  # generate a sh file for ssh login for each server
chmod 700 ${env_name}_${alias_hname}_${short_hname}.sh # make gererated file executable
done < serverlist.txt

Wednesday, June 18, 2014

Xlib: Client is not authorized to connect to Server Exceed

ISSUE:

Remote display is refused by local exceed server.

Cause:

host acceptence ACL is not configured for the remote server.

Solution:

configure exceed to accept anyhost or the remote servers you want

1.  click Start -> all program -> Hummingbird Connectivity 2008 x64 -> exceed tools -> Xconfig



2. click icon "Security, Access Control and System Administration" category.


3. select file if you need input a list of servers or any host access for all hosts

4. save and exit

Friday, January 24, 2014

ERROR OGG-01224 Address already in use.

PROBLEM:
mgr cannot start. "ERROR   OGG-01224  Address already in use and ERROR   OGG-01668  PROCESS ABENDING." appear in mgr.rpt

CAUSE:
Previous mgr process is still runing, which used port 7810 according to parameter file.

SOLUTION:

as root:
root> netstat -nap | grep 7810
tcp        0      0 :::7810                     :::*                        LISTEN      7590/./mgr
root> kill -9 7590

restart mgr process.

ERROR OGG-01668 Oracle GoldenGate Manager for Oracle, mgr.prm: PROCESS ABENDING.

PROBLEM:
mgr process can not start. "ERROR   OGG-01668  Oracle GoldenGate Manager for Oracle, mgr.prm:  PROCESS ABENDING" appears in ggserr.log. "ERROR   OGG-01091  Oracle GoldenGate Manager for Oracle, mgr.prm:  Unable to open file "/app/oracle/gg/bin/dirrpt/MGR.rpt" (error 2, No such file or directory)." appears in ggserr.log.

CAUSE:
subdirectory is not created.

SOLUTION:
create subdirectories.

Tuesday, November 5, 2013

utlrp error with ORA-04045: errors during recompilation/revalidation of GGUSER.DDLREPLICATION

CAUSE:
Goldent Gate DDL is enabled on database. Trigger sys.GGS_DDL_TRIGGER_BEFORE will be fired for utlrp, but the trigger is failed because some Golden Gate object is invalid.

Solution:
1. disable the trigger as sysdba
alter trigger sys.GGS_DDL_TRIGGER_BEFORE disable ;
2. run utlrp
@?/rdbms/admin/utlrp.sql
3. enable the trigger as sysdba
alter trigger sys.GGS_DDL_TRIGGER_BEFORE enable ;


reference:
http://harikrishnakm.wordpress.com/2013/08/19/catuppst-sql-fails-with-gguser-ddlreplication-does-not-exist-after-upgrading-the-database/

Monday, October 14, 2013

Duplicate Database using RMAN backup without connecting to target for oracle 10g version on windows

PURPOSE:
Duplicate oracle 10g database in new server for testing without connecting to target.

STEPS:

STEP 1. make a backup

1.1 backup database
rman target /
run
{
allocate channel c1 type disk format 'F:\rman\rman_db_%d_%T_%U.rman';
backup as compressed backupset full database;
release channel c1;
}

1.2 backup controlfile
rman target /
run
{
allocate channel c1 type disk format 'F:\rman\rman_ctl_%d_%T_%U.rman';
backup as compressed backupset current controlfile;
release channel c1;
}

1.3 backup required archive logs
run
{
allocate channel c1 type disk format 'F:\rman_test\rman_arch_%d_%T_%U.rman';
backup archivelog sequence between 100 and 200 ;
release channel c1;
}

STEP 2. Create required directory for new database in new host

2.1 data file, log file and tempfile location
select name from v$datafile;
select member from v$logfile;
select name from v$tempfile;

mkdir D:ORACLE\ORADATA\TEST

2.2 other locations ( dump dest and archivelog dest)
show parameter dest

STEP 3. copy pfile and make modification

STEP 4. create windows service

radim -new -sid test -intpwd test

STEP 5. start instance

startup mount

STEP 6. restore control file and mount database

rman target /
set dbid=123456789;
restore controlfile from 'F:\rman\RMAN_ctl_test_20131011_95OM4JNU_1_1.RMAN';
alter database mount;

STEP 7. restore database from backup
new location need be specified by using "set new name"
catalog start with 'F:\rman'

rman target /
run
{
set newname for datafile 1 to 'D:\ORACLE\ORADATA\TEST1\SYSTEM01.DBF';
set newname for datafile 2 to 'D:\ORACLE\ORADATA\TEST1\UNDOTBS01.DBF';
set newname for datafile 3 to 'D:\ORACLE\ORADATA\TEST1\SYSAUX01.DBF';
set newname for datafile 4 to 'D:\ORACLE\ORADATA\TEST1\USERS01.DBF';
allocate channel c1 type disk format 'F:\rman\\RMAN_DB_%d_%T_%U.RMAN';
restore database  ;
release channel c1;
}

STEP 8. rename datafile and logfile
alter database rename file 'D:\ORACLE\ORADATA\TEST\SYSTEM01.DBF' to  'D:\ORACLE\ORADATA\TEST1\SYSTEM01.DBF';
alter database rename file 'D:\ORACLE\ORADATA\TEST\UNDOTBS01.DBF' to 'D:\ORACLE\ORADATA\TEST1\UNDOTBS01.DBF';
alter database rename file 'D:\ORACLE\ORADATA\TEST\SYSAUX01.DBF' to  'D:\ORACLE\ORADATA\TEST1\SYSAUX01.DBF';
alter database rename file 'D:\ORACLE\ORADATA\TEST\USERS01.DBF' to   'D:\ORACLE\ORADATA\TEST1\USERS01.DBF';

alter database rename file 'D:\ORACLE\ORADATA\TEST\REDO01.LOG' to 'D:\ORACLE\ORADATA\TEST1\REDO01.LOG';
alter database rename file 'D:\ORACLE\ORADATA\TEST\REDO02.LOG' to 'D:\ORACLE\ORADATA\TEST1\REDO02.LOG';
alter database rename file 'D:\ORACLE\ORADATA\TEST\REDO03.LOG' to 'D:\ORACLE\ORADATA\TEST1\REDO03.LOG';
alter database rename file 'E:\ORACLE\ORADATA\TEST\REDO01B.LOG' to 'E:\ORACLE\ORADATA\TEST1\REDO01B.LOG';
alter database rename file 'E:\ORACLE\ORADATA\TEST\REDO02B.LOG' to 'E:\ORACLE\ORADATA\TEST1\REDO02B.LOG';
alter database rename file 'E:\ORACLE\ORADATA\TEST\REDO03B.LOG' to 'E:\ORACLE\ORADATA\TEST1\REDO03B.LOG';


STEP 9. recover database to consistent state
rman target /
recover database until sequence 201;

STEP 10. open database with resetlogs and drop, recreate temp file
alter database open resetlogs;
alter tablespace temp add tempfile 'D:\ORACLE\ORADATA\TEST1\TEMP01.DBF' size 3G ;

ALTER DATABASE TEMPFILE 'D:\ORACLE\ORADATA\TEST\TEMP01.DBF' DROP INCLUDING DATAFILES;

STEP 11. set up network connection
sqlplus sys/test@test as sysdba

STEP 12. copy pfile of test to pfile of test1
chagne db name from test to test1

STEP 13. rename database
orapwd FILE=pwdtest.ora PASSWORD=test
startup mount
nid TARGET=SYS/test@test DBNAME=test1

STEP 14. set oracle_sid as test1 and open database with resetlogs
startup mount
alter database open restlogs;


REFERENCE:
http://dbaregistry.blogspot.com/2011/04/rman-duplicate-without-connecting-to.html
http://docs.oracle.com/cd/B28359_01/server.111/b28310/dfiles005.htm
http://docs.oracle.com/cd/B14117_01/server.101/b10825/dbnewid.htm
http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmdupad.htm
http://docs.oracle.com/cd/B19306_01/backup.102/b14191/rcmdupdb.htm
https://forums.oracle.com/thread/2421213
http://www.dba-oracle.com/t_rename_database_oracle_sid.htm
http://docs.oracle.com/html/B13831_01/admin.htm
http://docs.oracle.com/cd/B19306_01/server.102/b14231/dfiles.htm
http://ss64.com/ora/rman_format_string.html
http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams112.htm
http://linuxtechres.blogspot.com/2011/10/how-to-create-oracle-database-service.html