Sunday, December 30, 2007

Oracle Recovery Manager - RMan

Connect: rman target system/manager@svc-name

Configuration:
  • Device:Configure Device Type To Disk;
  • Retention:Configure Policy To Redundancy 3;
  • Parallelism:Configure Device Type DISK Parallelism 2;
  • Controlfile:Configure ControlFile Autobackup on;
  • Controlfile Format:Configure ControlFile Autobaclup Format For Device Type Disk To 'D:\backup\ora_cf_%F';
  • Datafile:Configure Channel [CH#] Device Type Disk Format 'D:\oracle\backup\ora_df_%s_%p_#c_%U';
  • Optimization:Configure Backup Optimization;

Backup:
  • Backup all: Backup Database Plus Archivelog;
  • Incremental Backup: Backup Incremental Level 0 Database;
  • Testing Backup: Backup Validate Database Archivelog All;
  • Backup Object: Backup [Datafile #, Tablespace name]
  • Backup Since: Backup Database Not Backedup Since Time 'Sysdate-1';

Wednesday, December 19, 2007

Windows System Information Command

Windows NT winmsd
Windows 2000 msinfo32
Windows XP systeminfo

Monday, December 17, 2007

Export Oracle Data Structres

exp userid=system file=full_ddl.dmp rows=n owner=user1,user2

userid: connecting user
file: destination file
rows=n: don't export data
owner: schema's that should be backed up

Sunday, December 16, 2007

Use Speech Engine in VBA

1- Define voice object
Dim vox As New SpVoice

2- Call speak
vox.Speak("Hello")

Keyboard Language of Text Fields in VBA

You can set default input keyboard language layout for every field without changing manually by alt-shift, you can set your desired setting like below
txtPers.KeyboardLanguage = 41 + 2 'Farsi Lang Id + 2
txtEng.KeyboardLanguage = 9 + 2 'English Lang ID + 2
txtEng.KeyboardLanguage = 0 'Default system Lang

Activate Spell Checking on Office

On every where of your code that you like you can put it
RunCommand acCmdSpelling

also you can put DoCmd.SetWarnings False before above call to don't display the message spell checking was successful and activate it again with DoCmd.SetWarnings True

Saturday, December 15, 2007

Adding New Voucher Printer

To add new voucher printer to VoMSXpress of Siemens, first add voucher in configuration (vomscore->V03->VoucherProviderList->VoucherProvider1->Values->VoucherPrinterList) and then create a directory in voms at /app/voucher/RIC_Iran/VOP/prod_out/ with the same name of the voucher printer in GUI and set owner and mod of the directory to appropriate setting(voms:sx,775).

Finally stop start vomsservice and vomsordermgr in task manager.

Wednesday, December 12, 2007

Transfer Oracle BLOB from Database Link

Valid Commands to Move BLOB records from remote db to local
CREATE TABLE t AS SELECT * FROM table1@remote_site;
INSERT INTO t SELECT * FROM table1@remote_site;
UPDATE t SET lobcol = (SELECT lobcol FROM table1@remote_site);
INSERT INTO table1@remote_site ...
UPDATE table1@remote_site ...
DELETE FROM table1@remote_site ...

Oracle Unix Timestamp

Generate Unix Timestamp in Oracle
SELECT (sysdate - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400) AS dt FROM dual;

and you can create functions for this:

FUNCTION unixtimestampToDate( in_Date IN number )
RETURN DATE IS
BEGIN
RETURN to_date('01-jan-1970','dd-mon-yyyy')+(in_Date/(60*60*24));
END ;

FUNCTION DateToUNIXTimestamp( in_Date IN DATE )
RETURN NUMBER IS
BEGIN
RETURN TRUNC((in_Date-TO_DATE('01-jan-1970','dd-mon-yyyy'))*60*60*24);
END ;

Wednesday, December 5, 2007

Create Auto Start Up Service in Linux

1-Create an script file /etc/init.d/abcdef that contain
#!/sbin/sh
case "$1" in
'start')
//what should be lunched to start task
;;
'stop')
//what should be lunched to stop task
;;
'restart')
//what should be lunched to restart task like goto stop and start
;;

*)
//default option
;;
esac
exit 0

2-Change owner and mod of script file:
chown root:other /etc/init.d/abcdef
chmod 774 /etc/init.d/abcdef

3-Make symbolic link for auto start and stop at desired runlevel RC
ln -s /etc/init.d/abcdef /etc/rc2.s/S99abc
ln -s /etc/init.d/abcdef /etc/rc0.s/K34abc

Linux I/O Redirection

# The following command saves stdout and stderr to the files "out.txt" and "err.txt", respectively.
[root@server /root]# ./cmd 1>out.txt 2>err.txt

# The following command appends stdout and stderr to the files "out.txt" and "err.txt", respectively.
[root@server /root]# ./cmd 1>>out.txt 2>>err.txt

# The following command functions similar to the above two commands, but also copies stdout and stderr to the files "stdout.txt" and "stderr.txt", respectively.
[root@server /root]# (((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3\
|tee stderr.txt) 3>&1 1>&2 2>&3) 1>out.txt 2>err.txt