创建类型名称:LOGGER_FACTORY

Type 说明:

CREATE OR REPLACE TYPE "LOGGER_FACTORY" AS OBJECT
(
v_program_owner VARCHAR2(100),
v_program_name VARCHAR2(100),
v_program_lineno VARCHAR2(100),
v_program_type VARCHAR2(100),
v_sub_program_name VARCHAR2(100),
v_program_param VARCHAR2(200),
v_log_level NUMBER(1),
v_logger_id NUMBER(10),
CONSTRUCTOR FUNCTION logger_factory(pi_pkg_name IN VARCHAR2,
pi_prc_name IN VARCHAR2,
pi_iv_id IN VARCHAR2,
pi_iv_planid IN VARCHAR2)
RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION logger_factory(pi_prc_name IN VARCHAR2 DEFAULT NULL, pi_parameters IN VARCHAR2 DEFAULT NULL)
RETURN SELF AS RESULT,
MEMBER PROCEDURE debug,
MEMBER PROCEDURE debug(MESSAGE IN VARCHAR2),
MEMBER PROCEDURE info(MESSAGE IN VARCHAR2),
MEMBER PROCEDURE monitor(MESSAGE IN VARCHAR2),
MEMBER PROCEDURE warn(MESSAGE IN VARCHAR2),
MEMBER PROCEDURE error(MESSAGE IN VARCHAR2),
MEMBER PROCEDURE error
);

Type 主体:

CREATE OR REPLACE TYPE BODY "LOGGER_FACTORY"

AS

CONSTRUCTOR FUNCTION logger_factory(pi_pkg_name    IN VARCHAR2,

pi_prc_name    IN VARCHAR2,

pi_iv_id       IN VARCHAR2,

pi_iv_planid   IN VARCHAR2)

RETURN SELF AS RESULT

IS

v_log_level_name   VARCHAR2(10);

v_records_count    NUMBER;

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

IF v_program_type = 'PACKAGE BODY'

THEN

v_sub_program_name   := UPPER(SUBSTR(pi_prc_name, 1, 100));

END IF;

v_program_param   := SUBSTR('IV_ID = ' || NVL(pi_iv_id, 'NULL') || ', IV_PLANID = ' || NVL(pi_iv_planid, 'NULL'), 1, 200);

SELECT z_logger_id_seq.NEXTVAL INTO v_logger_id FROM DUAL;

SELECT COUNT(1)

INTO v_records_count

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name = v_program_name;

IF v_records_count > 0

THEN

SELECT UPPER(TRIM(log_level))

INTO v_log_level_name

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name = v_program_name

AND ROWNUM = 1;

END IF;

IF v_log_level_name IS NULL

THEN

SELECT COUNT(1)

INTO v_records_count

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name IS NULL;

IF v_records_count > 0

THEN

SELECT UPPER(TRIM(log_level))

INTO v_log_level_name

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name IS NULL

AND ROWNUM = 1;

END IF;

END IF;

CASE v_log_level_name

WHEN 'DEBUG'

THEN

v_log_level   := 4;

WHEN 'INFO'

THEN

v_log_level   := 3;

WHEN 'WARN'

THEN

v_log_level   := 2;

WHEN 'ERROR'

THEN

v_log_level   := 1;

ELSE

v_log_level        := 3;

v_log_level_name   := 'INFO';

END CASE;

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (

z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'INIT:'||v_log_level_name,

'CALL FROM : (HOST=' || SYS_CONTEXT('USERENV', 'HOST') || ')(IP=' || SYS_CONTEXT('USERENV', 'IP_ADDRESS') || ')' || '(OS_USER = ' ||

SYS_CONTEXT                                                                                                                          (

'USERENV',

'OS_USER') || ') : ' || sys.login_user || '@' || sys.database_name || sys.instance_num);

COMMIT;

RETURN;

END;

CONSTRUCTOR FUNCTION logger_factory(pi_prc_name IN VARCHAR2 DEFAULT NULL, pi_parameters IN VARCHAR2 DEFAULT NULL)

RETURN SELF AS RESULT

IS

v_log_level_name   VARCHAR2(10);

v_records_count    NUMBER;

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

IF v_program_type = 'PACKAGE BODY'

THEN

v_sub_program_name   := UPPER(SUBSTR(pi_prc_name, 1, 100));

END IF;

v_program_param   := SUBSTR(pi_parameters, 1, 200);

SELECT z_logger_id_seq.NEXTVAL INTO v_logger_id FROM DUAL;

SELECT COUNT(1)

INTO v_records_count

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name = v_program_name;

IF v_records_count > 0

THEN

SELECT UPPER(TRIM(log_level))

INTO v_log_level_name

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name = v_program_name

AND ROWNUM = 1;

END IF;

IF v_log_level_name IS NULL

THEN

SELECT COUNT(1)

INTO v_records_count

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name IS NULL;

IF v_records_count > 0

THEN

SELECT UPPER(TRIM(log_level))

INTO v_log_level_name

FROM z_conf_log_level

WHERE     program_owner = v_program_owner

AND program_name IS NULL

AND ROWNUM = 1;

END IF;

END IF;

CASE v_log_level_name

WHEN 'DEBUG'

THEN

v_log_level   := 4;

WHEN 'INFO'

THEN

v_log_level   := 3;

WHEN 'WARN'

THEN

v_log_level   := 2;

WHEN 'ERROR'

THEN

v_log_level   := 1;

ELSE

v_log_level        := 3;

v_log_level_name   := 'INFO';

END CASE;

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (

z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'INIT:'||v_log_level_name,

'CALL FROM : (HOST=' || SYS_CONTEXT('USERENV', 'HOST') || ')(IP=' || SYS_CONTEXT('USERENV', 'IP_ADDRESS') || ')' || '(OS_USER = ' ||

SYS_CONTEXT                                                                                                                          (

'USERENV',

'OS_USER') || ') : ' || sys.login_user || '@' || sys.database_name || sys.instance_num);

COMMIT;

RETURN;

END;

MEMBER PROCEDURE debug

IS

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 4

THEN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'DEBUG',

v_program_owner || '.' || v_program_name || ' : line ' || v_program_lineno);

COMMIT;

END IF;

END;

MEMBER PROCEDURE debug(MESSAGE VARCHAR2)

IS

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 4

THEN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'DEBUG',

SUBSTR(MESSAGE, 1, 1024));

COMMIT;

END IF;

END;

MEMBER PROCEDURE info(MESSAGE VARCHAR2)

IS

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 3

THEN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'INFO',

SUBSTR(MESSAGE, 1, 1024));

COMMIT;

END IF;

END;

MEMBER PROCEDURE monitor(MESSAGE VARCHAR2)

IS

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 3

THEN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'INFO',

SUBSTR(MESSAGE, 1, 1024));

COMMIT;

END IF;

END;

MEMBER PROCEDURE warn(MESSAGE VARCHAR2)

IS

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 2

THEN

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message)

VALUES (z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'WARN',

SUBSTR(MESSAGE, 1, 1024));

COMMIT;

END IF;

END;

MEMBER PROCEDURE error(MESSAGE VARCHAR2)

IS

v_error_backtrace   VARCHAR2(1024);

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 1

THEN

--Sample of DBMS_UTILITY.format_error_stack:

--ORA-06512: at "SPUSEROPAG.OF_REPORTS", line 209

--ORA-06512: at "SPUSEROPAG.OF_REPORTS", line 3215

v_error_backtrace   := SUBSTR(DBMS_UTILITY.format_error_backtrace, 1, 1024);

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message,

err_program_owner,

err_program_name,

err_program_lineno)

VALUES (

z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'ERROR',

SUBSTR(v_error_backtrace || DBMS_UTILITY.format_error_stack || CHR(10) || MESSAGE, 1, 1024),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace,

'"',

1,

1) + 1,

INSTR(v_error_backtrace, '.') - INSTR(v_error_backtrace,

'"',

1,

1) - 1),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace, '.') + 1,

INSTR(v_error_backtrace,

'"',

1,

2) - INSTR(v_error_backtrace, '.') - 1),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace, 'line') + 5,

INSTR(v_error_backtrace, CHR(10)) - INSTR(v_error_backtrace, 'line') - 5));

COMMIT;

END IF;

END;

MEMBER PROCEDURE error

IS

v_error_backtrace   VARCHAR2(1024);

PRAGMA AUTONOMOUS_TRANSACTION;

BEGIN

IF v_log_level >= 1

THEN

--Sample of DBMS_UTILITY.format_error_stack:

--ORA-06512: at "SPUSEROPAG.OF_REPORTS", line 209

--ORA-06512: at "SPUSEROPAG.OF_REPORTS", line 3215

v_error_backtrace   := SUBSTR(DBMS_UTILITY.format_error_backtrace, 1, 1024);

OWA_UTIL.who_called_me(v_program_owner,

v_program_name,

v_program_lineno,

v_program_type);

INSERT INTO z_log(log_seq,

logger_id,

program_owner,

program_name,

sub_program_name,

program_lineno,

program_type,

program_param,

log_level,

log_message,

err_program_owner,

err_program_name,

err_program_lineno)

VALUES (

z_log_seq.NEXTVAL,

v_logger_id,

v_program_owner,

v_program_name,

v_sub_program_name,

v_program_lineno,

v_program_type,

v_program_param,

'ERROR',

SUBSTR(v_error_backtrace || DBMS_UTILITY.format_error_stack, 1, 1024),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace,

'"',

1,

1) + 1,

INSTR(v_error_backtrace, '.') - INSTR(v_error_backtrace,

'"',

1,

1) - 1),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace, '.') + 1,

INSTR(v_error_backtrace,

'"',

1,

2) - INSTR(v_error_backtrace, '.') - 1),

SUBSTR(v_error_backtrace,

INSTR(v_error_backtrace, 'line') + 5,

INSTR(v_error_backtrace, CHR(10)) - INSTR(v_error_backtrace, 'line') - 5));

COMMIT;

END IF;

END;

END;

引用:logger      logger_factory := logger_factory;

调用:logger.info();logger.error();

创建表:

1,z_log

create table Z_LOG

(

log_seq            NUMBER(10),

log_time           DATE default SYSDATE,

logger_id          NUMBER(10),

program_owner      VARCHAR2(100),

program_name       VARCHAR2(100),

sub_program_name   VARCHAR2(100),

program_lineno     VARCHAR2(100),

program_type       VARCHAR2(100),

program_param      VARCHAR2(200),

log_level          VARCHAR2(10),

log_message        VARCHAR2(1024),

err_program_owner  VARCHAR2(100),

err_program_name   VARCHAR2(100),

err_program_lineno VARCHAR2(100)

)

partition by range (LOG_TIME)

(

partition P_2015_1H values less than (TO_DATE(' 2015-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2015_2H values less than (TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2016_1H values less than (TO_DATE(' 2016-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2016_2H values less than (TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2017_1H values less than (TO_DATE(' 2017-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2017_2H values less than (TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2018_1H values less than (TO_DATE(' 2018-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2018_2H values less than (TO_DATE(' 2019-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2019_1H values less than (TO_DATE(' 2019-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2019_2H values less than (TO_DATE(' 2020-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2020_1H values less than (TO_DATE(' 2020-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2020_2H values less than (TO_DATE(' 2021-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2021_1H values less than (TO_DATE(' 2021-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2021_2H values less than (TO_DATE(' 2022-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2022_1H values less than (TO_DATE(' 2022-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2022_2H values less than (TO_DATE(' 2023-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2023_1H values less than (TO_DATE(' 2023-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2023_2H values less than (TO_DATE(' 2024-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2024_1H values less than (TO_DATE(' 2024-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2024_2H values less than (TO_DATE(' 2025-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2025_1H values less than (TO_DATE(' 2025-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2025_2H values less than (TO_DATE(' 2026-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2026_1H values less than (TO_DATE(' 2026-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2026_2H values less than (TO_DATE(' 2027-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2027_1H values less than (TO_DATE(' 2027-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2027_2H values less than (TO_DATE(' 2028-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2028_1H values less than (TO_DATE(' 2028-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2028_2H values less than (TO_DATE(' 2029-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2029_1H values less than (TO_DATE(' 2029-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2029_2H values less than (TO_DATE(' 2030-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2030_1H values less than (TO_DATE(' 2030-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2030_2H values less than (TO_DATE(' 2031-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2031_1H values less than (TO_DATE(' 2031-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2031_2H values less than (TO_DATE(' 2032-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2032_1H values less than (TO_DATE(' 2032-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2032_2H values less than (TO_DATE(' 2033-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2033_1H values less than (TO_DATE(' 2033-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2033_2H values less than (TO_DATE(' 2034-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2034_1H values less than (TO_DATE(' 2034-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2034_2H values less than (TO_DATE(' 2035-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2035_1H values less than (TO_DATE(' 2035-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2035_2H values less than (TO_DATE(' 2036-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2036_1H values less than (TO_DATE(' 2036-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2036_2H values less than (TO_DATE(' 2037-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2037_1H values less than (TO_DATE(' 2037-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2037_2H values less than (TO_DATE(' 2038-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2038_1H values less than (TO_DATE(' 2038-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2038_2H values less than (TO_DATE(' 2039-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2039_1H values less than (TO_DATE(' 2039-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_2039_2H values less than (TO_DATE(' 2040-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

),

partition P_DEFAULT values less than (MAXVALUE)

tablespace USERS

pctfree 10

initrans 1

maxtrans 255

storage

(

initial 8M

next 1M

minextents 1

maxextents unlimited

)

);

-- Create/Recreate indexes

create index IDX_Z_LOG_001 on Z_LOG (LOG_TIME)

nologging  local;

-- Grant/Revoke object privileges

grant select, insert, update, delete on Z_LOG to PUBLIC; -- 给公共权限

2、Z_CONF_LOG_LEVEL

create table Z_CONF_LOG_LEVEL

(

program_owner VARCHAR2(100),

program_name  VARCHAR2(100),

log_level     VARCHAR2(10)

);

-- Grant/Revoke object privileges

grant select, insert, update, delete on Z_CONF_LOG_LEVEL to DML_ROLE;

grant select, insert, update, delete on Z_CONF_LOG_LEVEL to PUBLIC;

3、序列 Z_LOG_SEQ

create sequence Z_LOG_SEQ

minvalue 1

maxvalue 9999999999

start with 1

increment by 1

cache 1000

cycle

order;

Oracle 程序中超好用的日志记录TYPE,可以直接Copy使用的更多相关文章

  1. PHP中错误与异常的日志记录用法分析

    原文:http://www.jb51.net/article/89548.htm ----------------------------------------------------------- ...

  2. python中利用logging包进行日志记录时的logging.level设置选择

    之前在用python自带的logging包进行日志输出的时候发现有些logging语句没有输出,感到比较奇怪就去查了一下logging文档.然后发现其在设置和引用时的logging level会影响最 ...

  3. asp.net Web项目中使用Log4Net进行错误日志记录

      使用log4net可以很方便地为应用添加日志功能.应用Log4net,开发者可以很精确地控制日志信息的输出,减少了多余信息,提高了日志记录性能.同时,通过外部配置文件,用户可以不用重新编译程序就能 ...

  4. 使用Scrapy编写爬虫程序中遇到的问题及解决方案记录

    1.创建与域名不一致的Request时,请求会报错 解决方法:创建时Request时加上参数dont_filter=True 2.当遇到爬取失败(对方反爬检测或网络问题等)时,重试,做法为在解析res ...

  5. LOL游戏程序中对一些函数的Hook记录(Win10 x64)

    [PC Hunter Standard][League of Legends.exe-->Ring3 Hook]: 108Hooked Object Hook Address and Locat ...

  6. BeanFactory 使用控制反转 (IOC) 模式将应用程序的配置和依赖性规范与实际的应用程序代码分开。面向切面 将声明性事务管理集成到应用程序中

    Spring 系列: Spring 框架简介 https://www.ibm.com/developerworks/cn/java/wa-spring1/ Spring 框架简介 Spring AOP ...

  7. (14)ASP.NET Core 中的日志记录

    1.前言 ASP.NET Core支持适用于各种内置和第三方日志记录提供应用程序的日志记录API.本文介绍了如何将日志记录API与内置提供应用程序一起使用. 2.添加日志提供程序 日志记录提供应用程序 ...

  8. 程序中的Cookie 和Session

    这几天回家休息后,想想放假之前的几天,主要看的一些工作上的东西,发现对Session和Cookie这两个东西,我还是很陌生.恩,趁着有网,看了点相关的资料,打算整理下.一翻博客,发现已经有前辈已经对这 ...

  9. Java学习笔记(十九)——Java 日志记录 AND log4j

    [前面的话] 学习的进度应该稍微在快一点. Java日志到了必须学习怎么使用的时候了,因为在项目中要进行使用.基础性文章,选择性阅读. [结构] java日志对调试,记录运行,问题定位都起到了很重要的 ...

随机推荐

  1. Winfrom中如何使用Iconfont字体图标补充

    1.参考技术文章:http://www.cnblogs.com/isaboy/p/csharp_Font_Awesome_window_form_icon.html 2.参考后主要纠结在图标的unic ...

  2. php通过COM类调用组件的实现代码

    在PHP 4.2.0 至 4.2.3中,可以使用w32api_register_function 函数调用外部的DLL,前提是需要在php.ini中打开扩展的php_w32api.dll. 如果使用的 ...

  3. GridView的HyperLinkField的DataNavigateUrlFormatString如何使用自定义的变量,而不是数据库绑定的值

    GridView的HyperLinkField的DataNavigateUrlFormatString如何使用自定义的变量,而不是数据库绑定的值.报错:指定的参数已超出有效值的范围.参数名: inde ...

  4. mangle和demangle

    转:https://www.cnblogs.com/robinex/p/7892795.html. mangle和demangle C/C++语言在编译以后,函数的名字会被编译器修改,改成编译器内部的 ...

  5. mybatis“$”和“#”

    摘要:$ 是直接拼接# 会转义,更安全 类比Mybatis的执行流程和JDBC原有的我们使用的方法就是:Mybatis: Sqlsession -> Executor -> Stateme ...

  6. Oracle 查询历史数据(转帖)

    回复误删除数据信息. 1.执行 alter table table_name enable row movement; 2.执行 FlashBack table table_name to times ...

  7. python中tornado的第一个例子

    1  先安装tornado pip install tornado 2 新建tor.py 记住不能建立 tornado.py 这样的名字  不然会报错 ImportError: No module n ...

  8. JDK动态代理代码示例

    JDK动态代理代码示例 业务接口 实现了业务接口的业务类 实现了InvocationHandler接口的handler代理类 1.业务接口 package com.wzq.demo01; /** * ...

  9. MyBatis 延迟加载 加载时机

  10. 【poj2411】Mondriaan's Dream 状态压缩dp

    AC传送门:http://vjudge.net/problem/POJ-2411 [题目大意] 有一个W行H列的广场,需要用1*2小砖铺盖,小砖之间互相不能重叠,问有多少种不同的铺法? [题解] 对于 ...