To run sql commands of oracle in a script to use abilities of it like scheduling with crontab write the shell script commands in script.sh as belows
script.sh:
FILENAME=$(date +'%d-%m-%Y.txt')
sqlplus user/pass@db-sid <<EOL >> $FILENAME
select * from tbl1 where rownum<10000;
EOL
If sqlplus can't be run in the context of the this user the above script can be called in another script with su -c or specifying oracle user in crontab.
Tuesday, July 29, 2008
Monday, May 19, 2008
Delete Duplicate Rows in Oracle
DELETE FROM our_table
WHERE rowid not in
(SELECT MIN(rowid)
FROM our_table
GROUP BY column1, column2, column3... ;
Wednesday, May 14, 2008
Sun Volume Maintenance
1- Check volumes by metastat to see is there a mirror or submirror which contains not OK state(Last Erred|Needs Maintenance|Resyncing) like below:
metastat d5
d25: Submirror of d5
State: Resyncing
Size: 8395200 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t1d0s5 0 No Resyncing
2- Check disk needs maintenance with format analyze or fsck commands.
3- If error repaired re-enable submirror with metareplace command:
metareplace -e d5 c1t1d0s5
after the command, submirror state change to Resyncing and if there is no hard error it will become OK.
Complete Help @ Sun
metastat d5
d25: Submirror of d5
State: Resyncing
Size: 8395200 blocks
Stripe 0:
Device Start Block Dbase State Hot Spare
c1t1d0s5 0 No Resyncing
2- Check disk needs maintenance with format analyze or fsck commands.
3- If error repaired re-enable submirror with metareplace command:
metareplace -e d5 c1t1d0s5
after the command, submirror state change to Resyncing and if there is no hard error it will become OK.
Complete Help @ Sun
Tuesday, May 13, 2008
Microsoft Mary, Mike and Sam Voice SAPI 5.0
To install additional voice for Microsoft Text to Speech 5.0 (TTS) download and install the following package from Microsoft:
http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe
If the engine is not installed download engine 5.1 and install this first:
https://www.cepstral.com/downloads/public/other/SAPI_5.1_installer.msi
http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe
If the engine is not installed download engine 5.1 and install this first:
https://www.cepstral.com/downloads/public/other/SAPI_5.1_installer.msi
Microsoft Mary, Mike and Sam Voice SAPI 5.0
To install additional voice for Microsoft Text to Speech 5.0 (TTS) download and install the following package from Microsoft:
http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe
If the engine is not installed download engine 5.1 and install this first:
https://www.cepstral.com/downloads/public/other/SAPI_5.1_installer.msi
http://download.microsoft.com/download/speechSDK/SDK/5.1/WXP/EN-US/speechsdk51.exe
If the engine is not installed download engine 5.1 and install this first:
https://www.cepstral.com/downloads/public/other/SAPI_5.1_installer.msi
Monday, April 21, 2008
Remove Unix User Expiry Date
To remove expiry date of a user's password the following command can be used:
usermod -e "" username
The command will change shadow file, not manually. The value of parameter -e can be a date to set a new expiry date.
usermod -e "" username
The command will change shadow file, not manually. The value of parameter -e can be a date to set a new expiry date.
Sunday, April 13, 2008
.rhosts and remote login
To allow a username can be used for remote login and tools like rcp, in the home directory of that user should add a file .rhosts and add the trusted host name or ip in that. To allow all host can use + char.
A point should be considered is that the permissions of the owner of this file should be set. (chmod [700, 600,500,400] .rhosts).
-rwx------ 1 user1 other 20 Apr 13 17:39 .rhosts
Another file that is used by system to remote access after checking of .rhosts is /etc/hosts.equiv. Each recored line in this file contain hostname [username], means which user from which machine can access without password to this machine. Same as previous file + char can be used to indicate all host or/and all users.
Attend to this point that user is local user that exist in /etc/passwd of
server machine.
A point should be considered is that the permissions of the owner of this file should be set. (chmod [700, 600,500,400] .rhosts).
-rwx------ 1 user1 other 20 Apr 13 17:39 .rhosts
Another file that is used by system to remote access after checking of .rhosts is /etc/hosts.equiv. Each recored line in this file contain hostname [username], means which user from which machine can access without password to this machine. Same as previous file + char can be used to indicate all host or/and all users.
Attend to this point that user is local user that exist in /etc/passwd of
server machine.
Subscribe to:
Posts (Atom)
