Spend three days to figure out how to copy an oracle DB table from a cronjob.
After some intensive surfing for reference online, finally realize what I miss is the declaration.
It is worthy to note down:
For sh:
#!/bin/sh
ORACLE_HOME=/DB/HOME
export ORACLE_HOME
ORACLE_BASE=/DB/HOME
export ORACLE_BASE
ORACLE_OWNER=oracle
export ORACLE_OWNER
ORACLE_SID=MYDBID
export ORACLE_SID
NLS_LANG="american_america.we8iso8859p1"
export NLS_LANG
HOME=/HOME/DIR/
PATH=/usr/bin:/bin:/usr/local/bin:$ORACLE_HOME/bin
export PATH
sqlplus -s username/password@MYDBID @${HOME}/script.sql >> ${HOME}/something.txt
For csh:
#!/bin/csh
setenv ORACLE_HOME /DB/HOME
setenv ORACLE_BASE /DB/HOME
setenv ORACLE_OWNER oracle
setenv ORACLE_SID MYDBID
setenv NLS_LANG "american_america.we8iso8859p1"
set HOME = /HOME/DIR/
setenv PATH /usr/bin:/bin:/usr/local/bin:$ORACLE_HOME/bin
sqlplus -s username/password@MYDBID @${HOME}/script.sql >> ${HOME}/something.txt
-hayashi
Monday, June 27, 2011
Friday, April 8, 2011
know my public IP in Unix
wget -q -O - http://ipchicken.com | grep 203...
Tuesday, February 22, 2011
Tokenizer
Java:
String speech = "Four score and seven years ago";
StringTokenizer st = new StringTokenizer(speech);
while (st.hasMoreTokens()) {
println(st.nextToken());
}
Thursday, February 17, 2011
Wednesday, February 9, 2011
About chmod...
1. set it readable only for outsiders:
2. Take away all permissions for the group for
3. Open up
| Before: | -rwxr-xr-x archive.sh |
| Command: | chmod o=r archive.sh |
| After: | -rwxr-xr-- archive.sh |
topsecret.inf | Before: | -rw-r----- topsecret.inf |
| Command: | chmod g= topsecret.inf |
| After: | -rw------- topsecret.inf |
publicity.html for reading and writing by anyone. | Before: | -rw-r--r-- publicity.html |
| Command: | chmod og=rw publicity.html |
| After: | -rw-rw-rw- publicity.html |
Passwordless SSH connection
Spend the whole day to figure out how it works = ="
This is the scenario where server A wants to establish a connection to B without keying password:
a) Log in Server A with user Id 'userA' and corresponding passowrd.
b) Create the keys in server 'A' with the following command.
/user/local/bin/ssh-keygen –t rsa
c) Copy the public key in id_rsa.pub file under HOME_DIRECTOR/.ssh directory of server 'A'
d) Copy the 'id_rsa.pub' file of server A to 'authorized_keys' file of server B in B's HOME_DIRECTORY/.ssh directory
e) Grant both .ssh/ of server A & B 700 (chmod -R 700 .ssh/)
f) Log into server 'A' with 'userA' user ID
g) Execute the sftp command for server B, eg. sftp userB@Bserver
b) Create the keys in server 'A' with the following command.
/user/local/bin/ssh-keygen –t rsa
c) Copy the public key in id_rsa.pub file under HOME_DIRECTOR/.ssh directory of server 'A'
d) Copy the 'id_rsa.pub' file of server A to 'authorized_keys' file of server B in B's HOME_DIRECTORY/.ssh directory
e) Grant both .ssh/ of server A & B 700 (chmod -R 700 .ssh/)
f) Log into server 'A' with 'userA' user ID
g) Execute the sftp command for server B, eg. sftp userB@Bserver
Tuesday, February 8, 2011
Current time
$ date Tue Dec 19 21:16:03 CST 2000 $ date +"%m" 12 $ date +"%B" December $ date +"%Y-%m-%d" 2000-12-19 $
Subscribe to:
Posts (Atom)