11. Sql
dump function
In Decimal
devracdw1> select
dump('hello') from dual
2 /
DUMP('HELLO')
---------------------------------
Typ=96 Len=5:
104,101,108,108,111
In Octat
devracdw1> select
dump('hello',8) from dual
2 /
DUMP('HELLO',8)
---------------------------------
Typ=96 Len=5:
150,145,154,154,157
In Hex
devracdw1> select
dump('hello',16) from dual
2 /
DUMP('HELLO',16)
----------------------------
Typ=96 Len=5: 68,65,6c,6c,6f
In Characters
devracdw1> select
dump('hello',1017) from dual
2 /
DUMP('HELLO',1017)
-------------------------------------------------
Typ=96 Len=5
CharacterSet=WE8ISO8859P1: h,e,l,l,o
22. Using
Q-quote mechanism to escape ‘
FEWER quotes here., which is good
devracdw1> select q'(name
LIKE '%BAJWA%')' from dual
2 /
Q'(NAMELIKE'%BAJWA%
-------------------
name LIKE '%BAJWA%'
more quotes here., which is bad
devracdw1> select 'name
like ''%BAJWA%''' from dual
2 /
'NAMELIKE''%BAJWA%'
-------------------
name like '%BAJWA%'
33. Better
grep command
Instead
of using grep –v
[oracle@devrac-a-01] ps -ef |
grep pmon | grep -v grep
grid
19698 1 0 Sep29
? 00:00:40 asm_pmon_+ASM1
oracle
25406 1 0 Sep29
? 00:01:05 ora_pmon_qaracdw1
oracle
26512 1 0 Sep29
? 00:01:02 ora_pmon_devracdw1
Just replace the first character that you are searching inside [
square braces like below.
[oracle@devrac-a-01] ps -ef
|grep [p]mon
grid
19698 1 0 Sep29
? 00:00:40 asm_pmon_+ASM1
oracle
25406 1 0 Sep29
? 00:01:05 ora_pmon_qaracdw1
oracle
26512 1 0 Sep29
? 00:01:02 ora_pmon_devracdw1
4. Find the space hogs in current directory
[oracle@devrac-a-01] du -k |
sort -n
12
./cognos
16
./10053
16
./chad
20
./adm/sqlt/utl/mon
28
./pq
36
./adm/sqlt/input/sample/minidb
76
./adm/sqlt/utl/xgram
84
./adm/sqlt/doc
84
./adm/sqlt/input/sample
88
./adm/sqlt/input
88
./adm/sqlt/utl/xhume
92
./adm/sqlt/utl/spm
108
./adm/sqlt/utl/xplore
512
./parallel
704
./clark
724
./adm/sqlt/utl
3372
./sql_health/sqlhc
3456
./sql_health
5388
./adm/sqlt/install
16248 ./awr
46172
./adm/sqlt/run
52516 ./adm/sqlt
53484 ./adm
74872 .
5. Find How to set SQL prompt
15:32:02 SYS@devracdw:1>
[oracle@devrac-a-01] sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Wed Oct 29 15:31:58
2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
> @conn
Enter value for 1: / as sysdba
Connected.
AUDSID
OS_USER
HOST
IP_ADDRESS
--------------- ------------ -------------------- ------------
LANGUAGE
ISDBA
------------------------------ -----
4294967295
oracle devrac-a-01.cssd.pit
t.edu
AMERICAN_AMERICA.WE8ISO8859P1 TRUE
15:32:02 SYS@devracdw:1>

No comments:
Post a Comment