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

Wednesday, November 28, 2007

Set A Job To Run Every Hour on Top of The Hour

In sql*plus:
VARIABLE jobno number;
BEGIN
DBMS_JOB.SUBMIT(:jobno,’myuser.myproc();',TRUNC(SYSDATE+(1/24), 'HH'),
'TRUNC(SYSDATE+(1/24),''HH'')');
END;

PRINT jobno; -- to display assigned job id to task

Tuesday, November 27, 2007

Install Oracle Supplied Packages

in sql*plus
@{ORACLE_HOME}\rdbms\admin\dbms****.sql (dbmsjob.sql)
@{ORACLE_HOME}\rdbms\admin\prvt****.plb (prvtjob.plb)

Sunday, November 25, 2007

Bypass Blue Screen and Reboot

HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Control\CrashControl\
AutoReboot

0 Do not restart automatically.
1 Restart automatically.

Force Program Exit

HKEY_CURRENT_USER\Control Panel\Desktop\AutoEndTasks

0 Processes do not end automatically. The system waits until the process ends, and, if the process takes more time than the value of the HungAppTimeout entry, the End Task dialog box appears, stating that the application cannot respond to the End Task request.

1 Processes end automatically.

Hung Application Time

Set HKEY_CURRENT_USER\Control Panel\Desktop\ HungAppTimeout to timeout in Milliseconds in decimal

Specifies how long the system waits for user processes to end after the user clicks the End Task command button in Task Manager or after the user has selected to restart or shutdown the system. If this threshold is exceeded, the End Task dialog box appears, stating that the process did not respond.

sshwindows sftp Change Default Home Directory

If home directory for user in /etc/passwd set to /home/..., it refer to C:\documents and settings\... folder on windows.

To access other drives or folders add /cygdrive/DRIVELETTER/ to beginning of the folder path like /cygdrive/e/download/

Disable Windows Shutdown in Logon Screen

1-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\Winlogon
2-Add a value named "ShutdownWithoutLogon" of type "REG_SZ" and set it to "0".
Restart Windows

Friday, November 9, 2007

Hibernate and Lock Windows in command line

rundll32.exe powrprof.dll,SetSuspendState Hibernate

rundll32.exe user32.dll,LockWorkStation

Friday, October 26, 2007

Enable File Sharing and Firewall

Try to change deny policy of your firewall about system process and port 445 on tcp inbound to allow. If not work try udp, too.

SSH for windows

download from SSHWindows and install. It's linux sshd with small cygwin. It installs as windows service(OpenSSHd)

after install in bin folder, run below commands:

mkgroup -l >> ..\etc\group
mkpassword -l >> ..\etc\passwd

Thursday, October 25, 2007

Useful Utilitis for Windows

NirCmd, a small command-line utility that allows you to do some useful tasks without displaying any user interface.

UnixUtils some ports of common GNU utilities to native Win32

Clear RunMRU at Loggoff

Set the following registery
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

ClearRecentDocsOnExit
1 : Clear
0 : Off
This setting also clear typed url in IE.

Good staff : http://windowsxp.mvps.org/

Configure Windows XP to Automatically Login

Click Start, Run and type CONTROL USERPASSWORDS2, and click Ok. Select the user account from the list (the account to which you want to automatically logon). Uncheck Users must enter a user name and password to use this computer option, and click Ok. Type the user account password and complete the process.

Or
Configure it manually in registry

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon

Set the DefaultDomainName, DefaultPassword (must be non-blank), and DefaultUserName. Set AutoAdminLogon to 1 (all are type REG_SZ). If you ever want to logon as a different user, hold down the shift key as you logoff.



Add Persian(Farsi) Keyboard Layout Manually

This step is useful if you can't add your languyage and keyboard by windows input languages in Regional Settings

1- Install Additional files for complex script and right to left languages
2- Get and put kbdfa.dll in system32 folder (It's farsi keyboard layout)
3- Open windows\inf\intl.inf and add the following settings
3-1-
[Locales]
00000429 = %Farsi% ,720 ,11,,0409:00000409,0429:00000429,0429:00000401
3-2- Enter after same entries
[00000429]
;
; Farsi (Iran)
;
DelReg = FontSubs.Registry.Remove,FileSystem.Registry.FE
AddReg = NLS.Registry.Farsi
AddReg = NLS.Setlang.0429,Font.CP1256.Substitutes

3-3- Enter after same entries (On my windows, It's only entry about this keyboard layout in that file)
[NLS.Registry.Farsi]
HKLM,System\CurrentControlSet\Control\NLS\Codepage, ACP,,1256
HKLM,System\CurrentControlSet\Control\NLS\Codepage,OEMCP,,720
HKLM,System\CurrentControlSet\Control\NLS\Codepage,MACCP,,10004
HKLM,"Software\Microsoft\Windows NT\CurrentVersion\FontMapper","DEFAULT",0x00010001,178
3-4-
[KBD.LGFiles.Install.Arabic]
kbdfa.dll ; Farsi

[KBD.LGFiles.Remove.Arabic]
kbdfa.dll ; Farsi

3-5-
[Strings]
Farsi = "Farsi"
KLT_124 = "Farsi"

4- Add below registry entries
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language Groups]
"d"="1"
d is equal to 13 for arabic group which can be find in intl.inf file.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"10000"="c_10000.nls"
"1256"="c_1256.nls"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Locale]
"00000429"="d"
These are farsi lang id and arabic lang group id

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\\00000429]
"Layout File"="KBDFA.DLL"
"Layout Text"="Farsi"
"Layout Display Name"="@%SystemRoot%\system32\input.dll,-5124"

Hide a User from the Windows Welcome List

create a special value under this registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList

Under this key you simply create a new DWORD value - the name matches the users name exactly, and the value is one of the following (Decimal format)

0 - Hides the user just from the welcome screen
1 - The user is shown

Two or more concurrent sessions in Windows XP (Terminal Server Patch)

The beta 2055 release of XP PRO SP2 let you run two or more sessions (one local console and one or more remote desktop) concurrently. But this functionality was removed in the Final release. This patch will enable two or more concurrent sessions in Windows XP PRO Service Pack 2 (SP2) or later if you have FAST USER SWITCHING enabled, and your windows is NOT in a domain.

Uninstaller is also included and can be found at windows Control Panel -> Add or Remove Programs.

Screenshot
Download Latest Binary

Sunday, October 21, 2007

Solaris Automatic Package Download

Using pkg-get package easily can search, compare and install package for solaris autmatically.

pkg-get -c|compare automake
pkg-get -i|install automake

configuration file: /opt/csw/etc/pkg-get.conf

Friday, October 19, 2007

enable NUM LOCK before a user logs on

To enable NUM LOCK before a user logs on, use the steps below.

1.Run Registry Editor (Regedt32.exe).
2.Navigate to HKEY_USERS\.Default\Control Panel\Keyboard.
3.Change the value for InitialKeyboardIndicators from 0 to 2.
Additional references:
217884 (http://support.microsoft.com/kb/217884/EN-US/) NUM LOCK Setting Reset After Logging Off Terminal Server

262625 (http://support.microsoft.com/kb/262625/EN-US/) How to Set the NUM LOCK State at Logon Using a Logon Script ID