Saturday, July 5, 2014

Modify LDAP Password

Find user in LDAP:

root@mail # ldaplist |grep username
dn: uid=username,ou=group4,ou=people,dc=domain,dc=ac,dc=th

Modify user in LDAP:

root@mail # ldapmodify -D "cn=directory manager" <enter>
Bind Password: blindpassword <enter>
dn: uid=username,ou=group4,ou=people,dc=domain,dc=ac,dc=th <enter> มาจากคำสั่งข้างบน
changetype: modify <enter>
replace: userPassword <enter>
userPassword: (password) <enter>

Tuesday, June 17, 2014

Example RMAN Script

RUN {


ALLOCATE CHANNEL ch00 TYPE 'DISK';
BACKUP
    TAG CONTROLFILE_BACKUP
    FORMAT '/u02/rman_backup/cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;

ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;

sql 'alter system archive log current';
sql 'alter sytem switch logfile;

BACKUP
    TAG MEIS_DB_BACKUP
    FORMAT '/u02/rman_backup/MEIS_%s_%p_%t'
    DATABASE;
   

RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;


ALLOCATE CHANNEL ch00 TYPE 'DISK';
ALLOCATE CHANNEL ch01 TYPE 'DISK';

BACKUP
   TAG ARCHIVELOG_BACKUP
   FORMAT '/u02/rman_backup/arc_MEIS_%s_%p_%t'
   ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;



}

EXP: Shell Script

==========================================================

#!/bin/bash
cd
. .bash_profile
export BACKUPPATH="path_to_backup_file"

for i in DB1 DB2
do
export DATAFILE="${i}_DATAFILE_$(date '+%Y%m%d')"
echo $DATAFILE
export ARCHIVEDLOG="${i}_ARCHIVEDLOG_$(date '+%Y%m%d')"
echo $ARCHIVEDLOG
export CONTROLFILE="${i}_CONTROLFILE_$(date '+%Y%m%d')"
echo $CONTROLFILE
export RMAN_LOG_FILE="RMAN_FULL_BACKUP_${i}_$(date '+%Y%m%d').out"
echo $RMAN_LOG_FILE
echo Backup_data_file_path=$BACKUPPATH

export ORACLE_SID=$i
rman target / msglog ${BACKUPPATH}/log/$RMAN_LOG_FILE <<EOF
run
{
ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
ALLOCATE CHANNEL ch02 TYPE DISK;
ALLOCATE CHANNEL ch03 TYPE DISK;

BACKUP
    TAG "${DATAFILE}"
    FORMAT '${BACKUPPATH}/${i}/DATA_${i}_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
RELEASE CHANNEL ch02;
RELEASE CHANNEL ch03;

ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;

BACKUP
   TAG "${ARCHIVEDLOG}"
   FORMAT '${BACKUPPATH}/${i}/arc_${i}_%s_%p_%t'
   ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;

ALLOCATE CHANNEL ch00 TYPE DISK;
BACKUP
    TAG "${CONTROLFILE}"
    FORMAT '${BACKUPPATH}/${i}/cntrl_${i}_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
}
CROSSCHECK BACKUP;
DELETE NOPROMPT OBSOLETE;
EXIT;
EOF
echo $i
done


tip: SCN

Controlfile----> Datafile----> Archivelog

Thursday, June 12, 2014

Transport TableSpace oracle 11g

Transport Tablespace Solaris SPARC to Solaris x86-64 cross endian
=================================================================

AVSREG @SPARC
======
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('AVSREG', TRUE);
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('NIDAREG', TRUE);
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('VNTQF', TRUE);
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('USERS', TRUE);


SELECT * FROM TRANSPORT_SET_VIOLATIONS; check violation


CREATE DIRECTORY mig AS '/data6/move/';
GRANT READ, WRITE ON DIRECTORY mig TO SYSTEM;


ALTER TABLESPACE AVSREG READ WRITE ;
ALTER TABLESPACE NIDAREG READ WRITE ;
ALTER TABLESPACE VNTQF READ WRITE ;
ALTER TABLESPACE USERS READ WRITE ;



expdp system/123456 DUMPFILE=AVSREG-ALL-META.dmp DIRECTORY=mig FULL=Y INCLUDE=USER,ROLE,ROLE_GRANT,PROFILE CONTENT=METADATA_ONLY LOGFILE=AVSREG-ALL-META.log
expdp system/123456 DUMPFILE=TS-AVSREG_NIDAREG_VNTQF_USERS.dmp DIRECTORY=mig TRANSPORT_TABLESPACES=AVSREG,NIDAREG,VNTQF,USERS TRANSPORT_FULL_CHECK=Y LOGFILE=TS-AVSREG_NIDAREG_VNTQF_USERS.log


CONVERT TABLESPACE AVSREG,NIDAREG,VNTQF,USERS
TO PLATFORM 'Solaris Operating System (x86-64)'
FORMAT '/data6/move/%U';

================================================================================================================================
AVSREG @'Solaris Operating System (x86-64)'


SELECT d.PLATFORM_NAME, ENDIAN_FORMAT FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;

data_D-NIDAREG_I-102677175_TS-AVSREG_FNO-5_ptpal3ld
data_D-NIDAREG_I-102677175_TS-NIDAREG_FNO-6_q0pal563
data_D-NIDAREG_I-102677175_TS-USERS_FNO-4_pvpal4sh
data_D-NIDAREG_I-102677175_TS-VNTQF_FNO-8_pupal4r3


CONVERT DATAFILE '/data/NIDAREG/data_D-NIDAREG_I-102677175_TS-AVSREG_FNO-5_ptpal3ld'
FORMAT '/data/NIDAREG/AVSREG01.DBF';

CONVERT DATAFILE '/data/NIDAREG/data_D-NIDAREG_I-102677175_TS-NIDAREG_FNO-6_q0pal563'
FORMAT '/data/NIDAREG/NIDAREG01.DBF';

CONVERT DATAFILE '/data/NIDAREG/data_D-NIDAREG_I-102677175_TS-USERS_FNO-4_pvpal4sh'
FORMAT '/data/NIDAREG/USERS001.DBF';

CONVERT DATAFILE '/data/NIDAREG/data_D-NIDAREG_I-102677175_TS-VNTQF_FNO-8_pupal4r3'
FORMAT '/data/NIDAREG/VNTQF01.DBF';


CREATE DIRECTORY migration AS '/data/mig/';
GRANT READ,WRITE ON DIRECTORY migration TO SYSTEM;

create temp Tablespace + set default Tablespace
drop tablespace users including contents;

impdp system/123456 DIRECTORY=migration DUMPFILE=AVSREG-ALL-META.dmp FULL=Y LOGFILE=AVSREG-ALL-META.log
impdp system/123456 DIRECTORY=migration DUMPFILE=TS-AVSREG_NIDAREG_VNTQF_USERS.dmp TRANSPORT_DATAFILES=/data/NIDAREG/AVSREG01.DBF,/data/NIDAREG/NIDAREG01.DBF,/data/NIDAREG/USERS001.DBF,/data/NIDAREG/VNTQF01.DBF logfile=TS-AVSREG_NIDAREG_VNTQF_USERS.log
 

/oracle/admin/NIDAREG/dpdump



ALTER TABLESPACE BMSTBS READ WRITE;
ALTER TABLESPACE USERS READ WRITE;


http://www.oracle-base.com/articles/misc/transportable-tablespaces.php

Thursday, May 29, 2014

Remove Disk on Solaris 10

remove disk Solaris 10
- unmount disk
- cfgadm -al ; for check medadata
- cfgadm -c unconfigure c0::dsk/c0t1d0
- devfsadm -Cv

Thursday, May 22, 2014

Remote Shutdown Windows

net use \\%a\$IPC password /USER:administrator
shutdown -m \\%a -s -f -t 0

Thursday, April 17, 2014

Solaris10 & X-manager

# svccfg
svc:> select cde-login
svc:/application/graphical-login/cde-login> listprop arg
dtlogin/args astring
svc:/application/graphical-login/cde-login> setprop dtlogin/args=astring:" -udpPort 177"
svc:/application/graphical-login/cde-login> quit
# svcadm restart cde-login
# ps -ef |grep dtlogin
root 25145 23150 0 06:22:50 pts/1 0:00 grep dtlogin
root 24997 1 0 06:22:01 ? 0:00 /usr/dt/bin/dtlogin -daemon -udpPort 177

Friday, March 21, 2014

Create Batch file as Windows Services

- Download Windows Server 2003 Resource Kit Tools @http://www.microsoft.com/en-us/download/details.aspx?id=17657

- Create Service
    sc create ServiceName binPath= 'path_to_binary' DisplayName= 'Name_of_Servies' start= auto

- Create Parameters on Regedit
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName

- Create Key name 'Parameters'

- Add String Value 'Application' for binary file (Full path)

- go to Services.msc

- on 'Log on' tab check box 'Allow service to interact with desktop'

ALCATEL 6900

write memory copy running certified reload from working no rollback-timeout