以下是我在一些網站上一點點節選出來的!我還會繼續整理!先來一部分!大家覺得好
網站太多了請到各網站的索引都有!
Oracle DBA 常用 Script
and the rollback segment being used in the database
Code:
column rr heading
column us heading
column os heading
column te heading
SELECT r
nvl(s
s
s
FROM
v$lock l
v$session s
v$rollname r
WHERE
l
trunc(l
l
l
ORDER BY r
/
By using this sql in the glogin
SCOTT@DB
Code:
The following code works on Oracle
You have to insert the following line of code in glogin
$ORACLE_HOME/sqlplus/admin
set termout off
set echo off
define X=NotConnected
define Y=DBNAME
Column Usr New_Value X
Column DBName New_Value Y
Select SYS_CONTEXT(
Select SYS_CONTEXT(
Select Global_Name DBNAME from Global_Name;
set termout on
set sqlprompt
Please note that this method will work only when you make a new sql plus session because when you make a new sql plus session
Code:
CREATE OR REPLACE PACKAGE bitwise IS
FUNCTION hexconverter (pi_number IN NUMBER)
RETURN CHAR;
FUNCTION hexconverter (pi_hexstr IN CHAR)
RETURN NUMBER;
FUNCTION bitand (pi_num
RETURN NUMBER;
FUNCTION bitor (pi_num
RETURN NUMBER;
FUNCTION bitxor (pi_num
RETURN NUMBER;
END bitwise;
/
CREATE OR REPLACE PACKAGE BODY bitwise
IS
FUNCTION numtohexchar (pi_number IN NUMBER)
RETURN CHAR
IS
v_hextoreturn CHAR (
BEGIN
IF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSIF pi_number =
v_hextoreturn :=
ELSE
raise_application_error (
END IF;
RETURN v_hextoreturn;
END numtohexchar;
FUNCTION hexchartonum (pi_hexchar IN CHAR)
RETURN NUMBER
IS
v_numtoreturn NUMBER (
BEGIN
IF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSIF pi_hexchar =
v_numtoreturn :=
ELSE
raise_application_error (
END IF;
RETURN v_numtoreturn;
END hexchartonum;
FUNCTION hexconverter (pi_number IN NUMBER)
RETURN CHAR
IS
i NUMBER;
v_digit NUMBER (
v_hexstr VARCHAR
BEGIN
v_hexstr := ;
FOR i IN REVERSE
LOOP
v_digit := MOD (TRUNC (pi_number / POWER (
v_hexstr := v_hexstr || numtohexchar (v_digit);
END LOOP;
RETURN v_hexstr;
END hexconverter;
FUNCTION hexconverter (pi_hexstr IN CHAR)
RETURN NUMBER
IS
i NUMBER;
v_digit NUMBER (
v_numtoreturn NUMBER;
v_hexstr
BEGIN
v_hexstr
v_numtoreturn :=
FOR i IN
LOOP
V_digit := hexchartonum (SUBSTR (v_hexstr
v_numtoreturn := v_numtoreturn + v_digit * POWER (
END LOOP;
RETURN v_numtoreturn;
END hexconverter;
FUNCTION bitand (pi_num
RETURN NUMBER
IS
v_hex
v_hex
v_raw
v_raw
v_rawresult RAW (
v_hexresult VARCHAR
v_numresult NUMBER;
BEGIN
v_hex
v_hex
v_raw
v_raw
v_rawresult := UTL_RAW
v_hexresult := RAWTOHEX (v_rawresult);
v_numresult := hexconverter (v_hexresult);
RETURN v_numresult;
END bitand;
FUNCTION bitor (pi_num
RETURN NUMBER
IS
v_hex
v_hex
v_raw
v_raw
v_rawresult RAW (
v_hexresult VARCHAR
v_numresult NUMBER;
BEGIN
v_hex
v_hex
v_raw
v_raw
v_rawresult := UTL_RAW
v_hexresult := RAWTOHEX (v_rawresult);
v_numresult := hexconverter (v_hexresult);
RETURN v_numresult;
END bitor;
FUNCTION bitxor (pi_num
RETURN NUMBER
IS
v_hex
v_hex
v_raw
v_raw
v_rawresult RAW (
v_hexresult VARCH
From:http://tw.wingwit.com/Article/program/Oracle/201311/16529.html