情境
需求
1. root帳號
2. visudo
步驟
1. 利用root登入 或是 其他有權限的使用者
2. 輸入 visudo,會自動開啟vi,在裡面找到
root ALL=(ALL) ALL
3. 在這個區塊輸入指定的username,並設定權限如下
username ALL=(ALL) ALL
4. :wq! 存檔, 指定的user已經可以使用sudo囉!
Log4j has three main components: loggers, appenders and layouts. These three types of components work together to enable developers to log messages according to message type and level, and to control at runtime how these messages are formatted and where they are reported.Logger用來記錄訊息,包含log等級與log類型
set heading off
set term off
set echo off
set feedback off
set pagesize 0
spool AllObjectsDrop.sql
SELECT 'DROP DATABASE LINK ' || OBJECT_NAME || ';' FROM USER_OBJECTS WHERE OBJECT_TYPE = 'DATABASE LINK';
SELECT 'DROP TYPE ' || OBJECT_NAME || ';' FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TYPE';
SELECT 'DROP TRIGGER ' || OBJECT_NAME || ';' FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TRIGGER';
select 'drop view '||view_name||';' from user_views;
select 'drop sequence '||sequence_name|| ';'from user_sequences;
select 'DROP MATERIALIZED VIEW ' || MVIEW_NAME || ';' FROM user_mviews;
select 'drop table '||table_name|| ';'from user_tables;
select 'drop procedure '||OBJECT_NAME|| ';'from USER_OBJECTS where OBJECT_TYPE = 'PROCEDURE';
select 'drop function '||OBJECT_NAME|| ';'from USER_OBJECTS where OBJECT_TYPE = 'FUNCTION';
select 'drop package '||OBJECT_NAME|| ';'from USER_OBJECTS where OBJECT_TYPE = 'package';
select 'drop synonym '||OBJECT_NAME||';' from USER_OBJECTS where OBJECT_TYPE = 'SYNONYM';
spool off
VBoxManage modifyhd "/path/to/dvi/file" --resize 50000
begin
-- Drop Tables
FOR REC IN (
SELECT table_name
FROM user_tables
WHERE NOT EXISTS(SELECT 1 FROM USER_VIEWS WHERE VIEW_NAME = TABLE_NAME)
and NOT EXISTS(SELECT 1 FROM USER_MVIEWS WHERE MVIEW_NAME = TABLE_NAME)
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE ' || REC.table_name;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- VIEW
FOR REC IN (
SELECT VIEW_NAME
FROM user_views
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP VIEW ' || REC.VIEW_NAME;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- MVIEW
FOR REC IN (
SELECT mview_name FROM USER_MVIEWS
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP MATERIALIZED VIEW ' || REC.mview_name;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- FUNCTION
FOR REC IN (
SELECT object_name FROM user_objects WHERE object_type = 'FUNCTION'
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP FUNCTION ' || REC.object_name;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- PROCEDURE
FOR REC IN (
SELECT object_name FROM user_objects WHERE object_type = 'PROCEDURE'
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP PROCEDURE ' || REC.object_name;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- DATABASE LINK
FOR REC IN (
SELECT object_name FROM user_objects WHERE object_type = 'DATABASE LINK'
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP DATABASE LINK ' || REC.object_name;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- TYPE
FOR REC IN (
SELECT object_name FROM user_objects WHERE object_type = 'TYPE'
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP TYPE ' || REC.object_name || ' FORCE';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
-- JOB
FOR REC IN (
SELECT object_name FROM user_objects WHERE object_type = 'JOB'
)
LOOP
dbms_scheduler.drop_job(REC.OBJECT_NAME);
END LOOP;
-- Drop SYNONYM
FOR REC IN (
select OBJECT_NAME from user_objects where object_type = 'SYNONYM'
)
LOOP
BEGIN
EXECUTE IMMEDIATE 'DROP SYNONYM ' || REC.OBJECT_NAME;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
END LOOP;
end;
靠左,中,右對齊 |