replace tab with spaces
expand
or %s/^i/ /g in vi
input ^i by type ctrl +v +i
input ^m by type ctrl +v +m
Wednesday, November 17, 2010
Friday, October 22, 2010
Check informaiotn in previous time range
following SQL output failed logins in previous 30 minutes.
SELECT TO_CHAR(current_timestamp AT TIME ZONE 'GMT', 'YYYY-MM-DD HH24:MI:SS TZD') AS curr_timestamp, COUNT(username) AS failed_count
FROM sys.dba_audit_session
WHERE returncode != 0
AND TO_CHAR(timestamp, 'YYYY-MM-DD HH24:MI:SS') >= TO_CHAR(current_timestamp - TO_DSINTERVAL('0 0:30:00'), 'YYYY-MM-DD HH24:MI:SS')
TO_DSINTERVAL
Syntax
to_dsinterval::=
Description of the illustration to_dsinterval.gif
Purpose
TO_DSINTERVAL converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to an INTERVAL DAY TO SECOND value.
char is the character string to be converted.
The only valid nlsparam you can specify in this function is NLS_NUMERIC_CHARACTERS. This argument can have the form:
NLS_NUMERIC_CHARACTERS = "dg"
where d and g represent the decimal character and group separator respectively.
Examples
The following example selects from the employees table the employees who had worked for the company for at least 100 days on January 1, 1990:
SELECT employee_id, last_name FROM employees
WHERE hire_date + TO_DSINTERVAL('100 10:00:00')
<= DATE '1990-01-01';
EMPLOYEE_ID LAST_NAME
----------- ---------------
100 King
101 Kochhar
200 Whalen
SELECT TO_CHAR(current_timestamp AT TIME ZONE 'GMT', 'YYYY-MM-DD HH24:MI:SS TZD') AS curr_timestamp, COUNT(username) AS failed_count
FROM sys.dba_audit_session
WHERE returncode != 0
AND TO_CHAR(timestamp, 'YYYY-MM-DD HH24:MI:SS') >= TO_CHAR(current_timestamp - TO_DSINTERVAL('0 0:30:00'), 'YYYY-MM-DD HH24:MI:SS')
TO_DSINTERVAL
Syntax
to_dsinterval::=
Description of the illustration to_dsinterval.gif
Purpose
TO_DSINTERVAL converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to an INTERVAL DAY TO SECOND value.
char is the character string to be converted.
The only valid nlsparam you can specify in this function is NLS_NUMERIC_CHARACTERS. This argument can have the form:
NLS_NUMERIC_CHARACTERS = "dg"
where d and g represent the decimal character and group separator respectively.
Examples
The following example selects from the employees table the employees who had worked for the company for at least 100 days on January 1, 1990:
SELECT employee_id, last_name FROM employees
WHERE hire_date + TO_DSINTERVAL('100 10:00:00')
<= DATE '1990-01-01';
EMPLOYEE_ID LAST_NAME
----------- ---------------
100 King
101 Kochhar
200 Whalen
Monday, September 27, 2010
dbms_output.putline()
in order to see the lines on screen of sqlplus.
use SET SERVEROUTPUT on SIZE 100000
use SET SERVEROUTPUT on SIZE 100000
Thursday, September 23, 2010
delete subdirecotry and files from a directory but not the directory
sometimes, people need delete only subdirectory and files in a direcotry but not the directory.
for example, we have following directory structure
tti - aa.log
- tt1 - ab.log
tti and tt1 are directories; aa.log and ab.log are files.
if all but tti are required to be deleted.
issue following command:
find tti/* -exec rm -rf {} \;
ATTEN:
find tti -exex tm -rf {} \; will not work because it delet tti too.
Following is the output test in solaris 10
:->find tti -exec ls -ltr {} \;
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:36 aa.log
drwxr-xr-x 2 oracle dba 96 Sep 23 11:37 tt1
-rw-r--r-- 1 oracle dba 0 Sep 23 11:36 tti/aa.log
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:37 ab.log
-rw-r--r-- 1 oracle dba 0 Sep 23 11:37 tti/tt1/ab.log
:->find tti -exec rm -rf {} \;
:->cd tti
bash: cd: tti: No such file or directory
:->
When tti/* is used
:->find tti/* -exec ls -ltr {} \;
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 tti/aa.log
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 ab.log
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 tti/tt1/ab.log
:->find tti/* -exec rm -rf {} \;
:->cd tti
:->ls
:->pwd
~/tti
for example, we have following directory structure
tti - aa.log
- tt1 - ab.log
tti and tt1 are directories; aa.log and ab.log are files.
if all but tti are required to be deleted.
issue following command:
find tti/* -exec rm -rf {} \;
ATTEN:
find tti -exex tm -rf {} \; will not work because it delet tti too.
Following is the output test in solaris 10
:->find tti -exec ls -ltr {} \;
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:36 aa.log
drwxr-xr-x 2 oracle dba 96 Sep 23 11:37 tt1
-rw-r--r-- 1 oracle dba 0 Sep 23 11:36 tti/aa.log
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:37 ab.log
-rw-r--r-- 1 oracle dba 0 Sep 23 11:37 tti/tt1/ab.log
:->find tti -exec rm -rf {} \;
:->cd tti
bash: cd: tti: No such file or directory
:->
When tti/* is used
:->find tti/* -exec ls -ltr {} \;
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 tti/aa.log
total 0
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 ab.log
-rw-r--r-- 1 oracle dba 0 Sep 23 11:39 tti/tt1/ab.log
:->find tti/* -exec rm -rf {} \;
:->cd tti
:->ls
:->pwd
~/tti
Thursday, September 16, 2010
ISS (internet security systems) IBM
Proventia Management SitProtector Console
client version: 2.8.0.247
server version: 2.8.0.231
http://www.iss.net/support/documentation/docs.php?product=16&family=8
client version: 2.8.0.247
server version: 2.8.0.231
http://www.iss.net/support/documentation/docs.php?product=16&family=8
Wednesday, September 8, 2010
comment multiple lines in shell script
how to comment multiple lines in shell script
1.
Wrap the lines within :<< MARKER.. MARKER like shown below
Instead of MARKER you can use any string which is not used in your script. Preferably a unique string.
Code:
:<< COMMENT
a line in the script.
another line in the script
.
.
yet another line in script.
COMMENT
The above is the easiest thing to do.
2.
Else within vi you could issue
Code:
:10,20s/^/#/g
1.
Wrap the lines within :<< MARKER.. MARKER like shown below
Instead of MARKER you can use any string which is not used in your script. Preferably a unique string.
Code:
:<< COMMENT
a line in the script.
another line in the script
.
.
yet another line in script.
COMMENT
The above is the easiest thing to do.
2.
Else within vi you could issue
Code:
:10,20s/^/#/g
unix command TOP
top
c #full command line
n ## #disply ## process
s 20 # scan every 20 second
The default scan rate on top is 10 seconds. What this means is that with enough top sessions, and we ALL put them on , top itself starts to interfere with the machine. If you start top then type in “s 20” (only without the double quotes), you can change the scan rate to every 20 seconds. 30 would be even better.
If you type “c”, you should get a wider description of the commands. That will definitely help when every command displays as “oracle”. If this option does not work on some particular machine, please let me know and I will get it fixed.
And finally, if you type “n ##” where ## is some number, you will get that many top processes displayed instead of the default of 10.
c #full command line
n ## #disply ## process
s 20 # scan every 20 second
The default scan rate on top is 10 seconds. What this means is that with enough top sessions, and we ALL put them on , top itself starts to interfere with the machine. If you start top then type in “s 20” (only without the double quotes), you can change the scan rate to every 20 seconds. 30 would be even better.
If you type “c”, you should get a wider description of the commands. That will definitely help when every command displays as “oracle”. If this option does not work on some particular machine, please let me know and I will get it fixed.
And finally, if you type “n ##” where ## is some number, you will get that many top processes displayed instead of the default of 10.
Subscribe to:
Posts (Atom)