블로그 이미지
redkite

카테고리

분류 전체보기 (291)
00.SI프로젝트 산출물 (0)
00.센터 운영 문서 (0)
01.DBMS ============.. (0)
01.오라클 (117)
001.DB 관리 (19)
002.DB 마이그레이션 (8)
003.DB 백업 및 복구 (20)
004.DB 보안 (8)
005.DB 설치 (7)
006.DB 스크립트 (0)
007.DB Knowledge Bas.. (38)
008.DB 통계 및 공간 관리 (3)
009.DB Trouble Shoot.. (14)
010.교육자료 (0)
999.테스트 (0)
01.MS-SQL (15)
01.MySQL (30)
01.PostgreSql (0)
01.DB튜닝 (28)
====================.. (0)
02.SERVER ==========.. (0)
02.서버-공통 (11)
02.서버-Linux (58)
02.서버-Unix (12)
02.서버-Windows (2)
====================.. (0)
03.APPLICATION =====.. (11)
====================.. (0)
04.ETC =============.. (0)
04.보안 (5)
====================.. (0)
05.개인자료 (1)
06.캠핑관련 (0)
07.OA관련 (1)
Total
Today
Yesterday

달력

« » 2024.12
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

공지사항

최근에 올라온 글

how to change the character set from WE8MSWIN1252 to AL32UTF8 in oracle rac 11g.

Steps to change the character set from WE8MSWIN1252 to AL32UTF8

1. Make the cluster database to false from any of the node.

SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=SPFILE; -- RAC Only

2. Now shut down both the instance running on the nodes

SQL> SHUTDOWN IMMEDIATE;

3. Now start the database on any one node.

SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8; 
SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16; 
SQL> SHUTDOWN IMMEDIATE;


4. Now start the db on one node and change the cluster database parameter to true.

SQL> ALTER SYSTEM SET CLUSTER_DATABASE=true scope=spfile;

SQL> Shut immediate;

5. Now start the database using srvctl services

$ Srvctl start database –d RAC.



Asian data in AL16UTF16 is more compact than UTF8 and save disk space and have less disk I/O with Asian data. But The maximum lengths for NCHAR and NVARCHAR2 are 1000 and 2000 characters, which is less than the lengths for NCHAR (2000) and NVARCHAR2 (4000) in UTF8.

When we need to use European data... UTF8 better...

Assume I created database with NATIONAL CHARACTER SET AL16UTF16. And need to use UTF8.
Anyway should backup before and Export/[Import] data about NCHAR and NVARCHAR2...
Because We Can not change NATIONAL CHARACTER SET when NCLOB, NCHAR or NVARCHAR2 data exists.

set lines 130
set pages 10
column PROPERTY_NAME format a35
column PROPERTY_VALUE format a35
column DESCRIPTION format a35
select * from database_properties where property_name='NLS_NCHAR_CHARACTERSET'

PROPERTY_NAME PROPERTY_VALUE DESCRIPTION
--------------------------------------------------------------
NLS_NCHAR_CHARACTERSET AL16UTF16 NCHAR Character set

create table a (b nvarchar2(4000));
create table a (b nvarchar2(4000))
*
ERROR at line 1:
ORA-00910: specified length too long for its datatype

create table a (b nvarchar2(2001));
create table a (b nvarchar2(2001))
*
ERROR at line 1:
ORA-00910: specified length too long for its datatype

create table a (b nvarchar2(2000));

Table created.

Begin Step by Step...

- SHUTDOWN IMMEDIATE
- STARTUP MOUNT
- ALTER SYSTEM ENABLE RESTRICTED SESSION

Perhaps should:
alter system set job_queue_processes=0
alter system set aq_tm_processes=0

- ALTER DATABASE OPEN
- ALTER DATABASE NATIONAL CHARACTER SET UTF8

If =>
ALTER DATABASE NATIONAL CHARACTER SET UTF8
*
ERROR at line 1:
ORA-12717: Cannot issue ALTER DATABASE NATIONAL CHARACTER SET when NCLOB, NCHAR or NVARCHAR2 data exists

Check alert log and remove data from list (don't forget backup before), Example:

Mon Feb 09 11:52:45 2009
ALTER DATABASE NATIONAL CHARACTER SET UTF8
PM.PRINT_MEDIA (AD_FLTEXTN) - NCLOB populated
ORA-12717 signalled during: ALTER DATABASE NATIONAL CHARACTER SET UTF8....

remark:
ORA-12717: Cannot issue ALTER DATABASE NATIONAL CHARACTER SET when NCLOB, NCHAR or NVARCHAR2 data exists
Cause: NCLOB, NCHAR or NVARCHAR2 data changed the representation to Unicode when converting to a multibyte character set and must be migrated.
Action: Remove NCLOB, NCHAR or NVARCHAR2 data as listed in the alert file. The above type data can be migrated by methods such as import/export.

- SHUTDOWN IMMEDIATE
- STARTUP

PROPERTY_NAME PROPERTY_VALUE DESCRIPTION
---------------------------------------------------------------------
NLS_NCHAR_CHARACTERSET UTF8 NCHAR Character set

create table a (b nvarchar2(4000));

Table created.

Posted by redkite
, |

오라클 설치시 인스톨러에서 데이타베이스 자동 생성을 할 경우
OS 언어에 따라 자동으로 characterset 이 설정되어 설치되는데,
characterset을 임의로 변경하는 방법 입니다.

변경시나리오)

* 기존 개발용 오라클DB OLD_ORA 의 nls_characterset 은 US7ASCII 이다.

* 기존 클라이언트 nls_lang 은 AMERICAN_AMERICA.US7ASCII 이다.

* 새로운 한글windows OS에 오라클DB NEW_ORA 를 설치하였는데 nls_characterset 이 KO16MSWIN949 이다.

* OLD_ORA 의 데이타를 exp 유틸로 덤프를 떠서 NEW_ORA 에 imp 유틸로 복구하였는데,

일본및 중국 언어문자셋이 깨어져 버리고 ??? 등으로 바뀌어 유니크인덱스가 생성되지 않는다.

* 데이타 이전및 개발호환을 위해 nls_characterset 을 맞추기로 하였다.

새로 설치하지 않고 바꾸는 법 입니다.

절차 SQL> SHUTDOWN IMMEDIATE;
<만일의 사태를 대비해 풀백업을 한다>
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET US7ASCII;
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

ALTER DATABASE CHARACTER SET US7ASCII 변경할때

큰집합이여야 된다는(superset) 등의 에러메세지 떨어질 경우
update SYS.PROPS$ set value$='US7ASCII' where name='NLS_CHARACTERSET';
shutdown immediate;
startup;

클라이언트 nls_characterset 셋팅 :
regedit
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1
- NLS_LANG = AMERICAN_AMERICA.US7ASCII

[nls 환경보기]
--DB
SELECT * FROM nls_database_parameters
WHERE parameter='NLS_CHARACTERSET' OR parameter='NLS_LANGUAGE'

-- session
SELECT * FROM v$nls_parameters

===============================================================================================

위와 같이 설정후 OLD_ORA 데이타 덤프를 NEW_ORA 로 Import 시킨후 한글이 정상적으로 들어와 졌습니다.

그런데 SQLTools,토드 등으로 접속후 객체브라우져로 객체 리스트 보기에서 아래와 같은 에러가 발생하면서

ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: character set name is not recognized

객체리스트가 보이지 않았습니다.

원인) 아래 쿼리를 날렸을때 데이터 타입이 중복되어서 나옴

쿼리)

select distinct(nls_charset_name(charsetid)) CHARACTERSET,
decode(type#, 1, decode(charsetform, 1, 'VARCHAR2', 2, 'NVARCHAR2','UNKOWN'),
9, decode(charsetform, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN'),
96, decode(charsetform, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
112, decode(charsetform, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
from sys.col$ where charsetform in (1,2) and type# in (1, 9, 96, 112)

order by types_used_in;

결과)

CHARACTERSET TYPES_USED_IN
------------------------------ -------------
KO16MSWIN949 CHAR
US7ASCII CHAR
KO16MSWIN949 CLOB
US7ASCII CLOB
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
KO16MSWIN949 VARCHAR2
US7ASCII VARCHAR2

CHAR,CLOB,VARCHAR2 에 중복된 CHARACTERSET이 존재함.

위와 같은 경우 다음과 같이 조취합니다.

조치2) sysdba로 아래 구문들 실행

주의사항)

a) Make sure the parallel_server parameter in INIT.ORA is set to false or it is not set at all.
b) Run the next script in SQLPLUS connected "as sysdba"

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> COL VALUE NEW_VALUE CHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
SQL> COL VALUE NEW_VALUE NCHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;
-- yes, 2 times startup/shutdown . This is not a typo
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

만약 실행중 다음과 같은 오류발생시 아래단계 실행

오류가 안난다면 하지 않아도 됩니다.

ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE KO16KSC5601
==> ORA-12714: invalid national character set specified

원인)

NATIONAL CHARACTER SET 은 Oracle9i 이후에는 UTF8과 AL16UTF16 만 제공
확인)

SELECT VALUE
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER in ('NLS_NCHAR_CHARACTERSET','NLS_CHARACTERSET')
결과)

PARAMETER VALUE
---------------------------------- ---------------
NLS_CHARACTERSET KO16KSC5601

NLS_NCHAR_CHARACTERSET KO16KSC5601

조치)

update sys.props$ set value$='AL16UTF16' where name='NLS_NCHAR_CHARACTERSET';

이후 위의 조치2)를 다시실행하면 아래와 같은 결과를 얻을수 있다..

문제해결)

CHARACTERSET TYPES_USED_IN
------------------------------ -------------
US7ASCII CHAR
US7ASCII CLOB
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
US7ASCII VARCHAR2

이후 SQLTools 나 토드접속시 에러가 나지 않고 객체리스트가 정상적으로 나오게 됩니다.

Posted by redkite
, |

SELECT 'EXEC DBMS_UTILITY.compile_schema(schema => '||owner||');'

FROM   dba_objects

WHERE  status = 'INVALID'

ORDER BY owner, object_type, object_name

/



set heading off

set feedback off

set linesize 80


select 'alter view "' || object_name || '" compile;'

from user_objects

where object_type = 'VIEW'

and status = 'INVALID'

/


alter view "EMP_PUBLIC_DATA" compile;

alter view "VIEW_T" compile;

alter view "DEPT_EMP_VIEW" compile;

alter view "DEPARTMENT_10" compile;


set heading on

set feedback on


select 'show errors view ' || object_name

from user_objects

where object_type = 'VIEW'

and status = 'INVALID'

/


'SHOWERRORSVIEW'||OBJECT_NAME

--------------------------------------------------------------------------------

show errors view EMP_PUBLIC_DATA

show errors view VIEW_T

show errors view DEPT_EMP_VIEW

show errors view DEPARTMENT_10


4 rows selected.

Posted by redkite
, |

오라클에서 현재 사용하는 데이터 베이스에서

프로시저, 함수, USER_SOURCE 뷰를 보기 입니다.


SELECT * FROM USER_SOURCE;


LINE

NAME

TEXT

TYPE

소스 라인의 라인번호

객체의 이름

원본 텍스트

객체의 유형


TYPE : "TYPE", "TYPE BODY", "PROCEDURE", "FUNCTION", "PACKAGE", "PACKAGE BODY" or "JAVA SOURCE"

Posted by redkite
, |

Recompiling Invalid Schema Objects


Operations such as upgrades, patches and DDL changes can invalidate schema objects. Provided these changes don't cause compilation failures the objects will be revalidated by on-demand automatic recompilation, but this can take an unacceptable time to complete, especially where complex dependencies are present. For this reason it makes sense to recompile invalid objects in advance of user calls. It also allows you to identify if any changes have broken your code base. This article presents several methods for recompiling invalid schema objects.


Identifying Invalid Objects

The Manual Approach

Custom Script

DBMS_UTILITY.compile_schema

UTL_RECOMP

utlrp.sql and utlprp.sql

Identifying Invalid Objects


The DBA_OBJECTS view can be used to identify invalid objects using the following query.


COLUMN object_name FORMAT A30

SELECT owner,

       object_type,

       object_name,

       status

FROM   dba_objects

WHERE  status = 'INVALID'

ORDER BY owner, object_type, object_name;

With this information you can decide which of the following recompilation methods is suitable for you.


The Manual Approach


For small numbers of objects you may decide that a manual recompilation is sufficient. The following example shows the compile syntax for several object types.


ALTER PACKAGE my_package COMPILE;

ALTER PACKAGE my_package COMPILE BODY;

ALTER PROCEDURE my_procedure COMPILE;

ALTER FUNCTION my_function COMPILE;

ALTER TRIGGER my_trigger COMPILE;

ALTER VIEW my_view COMPILE;

Notice that the package body is compiled in the same way as the package specification, with the addition of the word "BODY" at the end of the command.


An alternative approach is to use the DBMS_DDL package to perform the recompilations.


EXEC DBMS_DDL.alter_compile('PACKAGE', 'MY_SCHEMA', 'MY_PACKAGE');

EXEC DBMS_DDL.alter_compile('PACKAGE BODY', 'MY_SCHEMA', 'MY_PACKAGE');

EXEC DBMS_DDL.alter_compile('PROCEDURE', 'MY_SCHEMA', 'MY_PROCEDURE');

EXEC DBMS_DDL.alter_compile('FUNCTION', 'MY_SCHEMA', 'MY_FUNCTION');

EXEC DBMS_DDL.alter_compile('TRIGGER', 'MY_SCHEMA', 'MY_TRIGGER');

This method is limited to PL/SQL objects, so it is not applicable for views.


Custom Script


In some situations you may have to compile many invalid objects in one go. One approach is to write a custom script to identify and compile the invalid objects. The following example identifies and recompiles invalid packages and package bodies.


SET SERVEROUTPUT ON SIZE 1000000

BEGIN

  FOR cur_rec IN (SELECT owner,

                         object_name,

                         object_type,

                         DECODE(object_type, 'PACKAGE', 1,

                                             'PACKAGE BODY', 2, 2) AS recompile_order

                  FROM   dba_objects

                  WHERE  object_type IN ('PACKAGE', 'PACKAGE BODY')

                  AND    status != 'VALID'

                  ORDER BY 4)

  LOOP

    BEGIN

      IF cur_rec.object_type = 'PACKAGE' THEN

        EXECUTE IMMEDIATE 'ALTER ' || cur_rec.object_type || 

            ' "' || cur_rec.owner || '"."' || cur_rec.object_name || '" COMPILE';

      ElSE

        EXECUTE IMMEDIATE 'ALTER PACKAGE "' || cur_rec.owner || 

            '"."' || cur_rec.object_name || '" COMPILE BODY';

      END IF;

    EXCEPTION

      WHEN OTHERS THEN

        DBMS_OUTPUT.put_line(cur_rec.object_type || ' : ' || cur_rec.owner || 

                             ' : ' || cur_rec.object_name);

    END;

  END LOOP;

END;

/

This approach is fine if you have a specific task in mind, but be aware that you may end up compiling some objects multiple times depending on the order they are compiled in. It is probably a better idea to use one of the methods provided by Oracle since they take the code dependencies into account.


DBMS_UTILITY.compile_schema


The COMPILE_SCHEMA procedure in the DBMS_UTILITY package compiles all procedures, functions, packages, and triggers in the specified schema. The example below shows how it is called from SQL*Plus.


EXEC DBMS_UTILITY.compile_schema(schema => 'SCOTT');

UTL_RECOMP


The UTL_RECOMP package contains two procedures used to recompile invalid objects. As the names suggest, the RECOMP_SERIAL procedure recompiles all the invalid objects one at a time, while the RECOMP_PARALLEL procedure performs the same task in parallel using the specified number of threads. Their definitions are listed below.


 PROCEDURE RECOMP_SERIAL(

   schema   IN   VARCHAR2    DEFAULT NULL,

   flags    IN   PLS_INTEGER DEFAULT 0);


PROCEDURE RECOMP_PARALLEL(

   threads  IN   PLS_INTEGER DEFAULT NULL,

   schema   IN   VARCHAR2    DEFAULT NULL,

   flags    IN   PLS_INTEGER DEFAULT 0);

The usage notes for the parameters are listed below.


schema - The schema whose invalid objects are to be recompiled. If NULL all invalid objects in the database are recompiled.

threads - The number of threads used in a parallel operation. If NULL the value of the "job_queue_processes" parameter is used. Matching the number of available CPUs is generally a good starting point for this value.

flags - Used for internal diagnostics and testing only.

The following examples show how these procedures are used.


-- Schema level.

EXEC UTL_RECOMP.recomp_serial('SCOTT');

EXEC UTL_RECOMP.recomp_parallel(4, 'SCOTT');


-- Database level.

EXEC UTL_RECOMP.recomp_serial();

EXEC UTL_RECOMP.recomp_parallel(4);


-- Using job_queue_processes value.

EXEC UTL_RECOMP.recomp_parallel();

EXEC UTL_RECOMP.recomp_parallel(NULL, 'SCOTT');

There are a number of restrictions associated with the use of this package including:


Parallel execution is perfomed using the job queue. All existing jobs are marked as disabled until the operation is complete.

The package must be run from SQL*Plus as the SYS user, or another user with SYSDBA.

The package expects the STANDARD, DBMS_STANDARD, DBMS_JOB and DBMS_RANDOM to be present and valid.

Runnig DDL operations at the same time as this package may result in deadlocks.

utlrp.sql and utlprp.sql


The utlrp.sql and utlprp.sql scripts are provided by Oracle to recompile all invalid objects in the database. They are typically run after major database changes such as upgrades or patches. They are located in the $ORACLE_HOME/rdbms/admin directory and provide a wrapper on the UTL_RECOMP package. The utlrp.sql script simply calls the utlprp.sql script with a command line parameter of "0". The utlprp.sql accepts a single integer parameter that indicates the level of parallelism as follows.


0 - The level of parallelism is derived based on the CPU_COUNT parameter.

1 - The recompilation is run serially, one object at a time.

N - The recompilation is run in parallel with "N" number of threads.

Both scripts must be run as the SYS user, or another user with SYSDBA, to work correctly.


For more information see:


DBMS_UTILITY.compile_schema

UTL_RECOMP


Posted by redkite
, |

오라클 COMMAND 창에서 

sql> show parameter undo; 

를 쳐보면 

undo_management 
undo_retention 
undo_tablespace 의 속성들에 대한 정보가 나오게 된다. 

그 중 undo_retention 은 delete, update 후에 ROLLBACK이 아닌 COMMIT을 하였을때 부터 

속성값의 초 까지는 오라클에서 임시로 저장을 하게끔 되어있다. 

DEFAULT 속성값은 '900' 으로 900/60초 = 15분 

COMMIT 후 15분 안에는 데이터를 복구 할 수 있게 된다. 

그 시간을 늘리거나 줄이려면 

'alter system set undo_retention = 1500 ; '          --1500초(25분) 

이렇게 늘릴수가 있다. 

지금까지는 복구를 위한 셋팅 방법이었으며, 이제는 복구 방법을 알아보자. 

복구를 하는 방법은 

DELETE FROM TEST WHERE USER_ID = 'ITDI'; 

COMMIT; 

위와 같은 방법으로 USER_ID = 'ITDI' 의 데이터를 TEST 테이블에서 삭제를 하고 COMMIT을 하였을 경우, 

SELECT * 
  FROM TEST 
 AS OF TIMESTAMP(SYSTIMESTAMP-INTERVAL '15' MINUTE) 
WHERE USER_ID = 'ITDI' ; 

이렇게 하면 삭제를 한지 15분안의 데이터를 찾아서 조회를 할수 있다. 

복구하는 방법은 CTAS를 써서 임시테이블에 넣어서 차차 복구를 하여도 되고 

다이렉트로 

INSERT INTO TEST 
SELECT * 
  FROM TEST 
 AS OF TIMESTAMP(SYSTIMESTAMP-INTERVAL '15' MINUTE) 
WHERE USER_ID = 'ITDI' ; 

이렇게 처리를 하여도 된다. 

일단 서버를 셋팅을 하게되고 중요한 운영DB일 경우에는 이와같은 방법으로 

데이타의 삭제를 예방할 수 있다. 

DMP 백업이나 ARCHIVE 백업등의 처리 또한 백업의 종류이기는 하나, 

위와 같은 방법이 백업복구의 대처 능력이 다른 복구작업보다 더 좋다고 생각한다.

Posted by redkite
, |

offline drop 명령어는 control file에서 datafile을 제거 후에
재생성 하는 것과 같은 이치입니다. 단지 차이는 데이터파일 명이 MISSING 인지
기존 파일명을 그대로 가지는지만 다르겠습니다.
- 컨트롤파일 재생성시
SQL> select name from v$datafile;
NAME


/u01/ora9i/oradata/PROD/system01.dbf
/u01/ora9i/oradata/PROD/undotbs01.dbf
/u01/ora9i/oradata/PROD/users01.dbf
/u01/ora9i/oradata/PROD/users02.dbf
/u01/ora9i/product/9.2.0/dbs/MISSING00005
/u01/ora9i/oradata/PROD/example01.dbf

일반 데이터가 들어가는 테이블스페이스의 데이터파일은 offline되었으므로
DB는 open이 가능합니다.하지만 해당 데이터파일을 복구하기 위해서는 백업과
archive가 필요합니다. offine drop된 데이터파일의 데이터를
읽으려고 할 경우에는 당연히 아래와 같은 메세지가 나고 해당 데이터는
복구 불능입니다. 일부를 추출하는 것도 여러 자료를 찾아보고
어떻게든 해보려고 했는데 안되네요.
테스트 해보기에는 block corruption 에러가 났을 경우에 수행하는
event를 적용했는데 역시 복구불능이었습니다.
dbms_repair로도 안되었습니다.
....
SQL> exec dbms_repair.admin_tables ( table_name => 'REPAIR_TABLE', -

table_type => dbms_repair.repair_table, -
action => dbms_repair.create_action, tablespace => 'EXAMPLE');

BEGIN dbms_repair.admin_tables ( table_name => 'REPAIR_TABLE', table_type => dbms_repair.repair_table, action => dbms_repair.create_action, tablespace => 'EXAMPLE'); END;
*
ERROR at line 1:
ORA-06550: line 1, column 83:
PLS-00201: identifier 'DBMS_REPAIR.REPAIR_TABLE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

SQL> select count(*) from hr.kkk;
select count(*) from hr.kkk
*
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01110: data file 5: '/u01/ora9i/oradata/PROD/users03.dbf'



recovery 수행

SQL> !cp /u01/ora9i/oradata/PROD_KKK/users03.dbf /u01/ora9i/oradata/PROD/users03.dbf
SQL> recover datafile '/u01/ora9i/oradata/PROD/users03.dbf';
ORA-00279: change 67160 generated at 02/05/2007 23:56:37 needed for thread 1
ORA-00289: suggestion : /u01/ora9i/oradata/PROD/archive/1_9.dbf
ORA-00280: change 67160 for thread 1 is in sequence #9

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00279: change 67297 generated at 02/06/2007 00:41:03 needed for thread 1
ORA-00289: suggestion : /u01/ora9i/oradata/PROD/archive/1_10.dbf
ORA-00280: change 67297 for thread 1 is in sequence #10
ORA-00278: log file '/u01/ora9i/oradata/PROD/archive/1_9.dbf' no longer needed for this recovery

ORA-00279: change 67299 generated at 02/06/2007 00:41:04 needed for thread 1
ORA-00289: suggestion : /u01/ora9i/oradata/PROD/archive/1_11.dbf
ORA-00280: change 67299 for thread 1 is in sequence #11
ORA-00278: log file '/u01/ora9i/oradata/PROD/archive/1_10.dbf' no longer needed for this recovery

Log applied.
Media recovery complete.
SQL> alter database datafile '/u01/ora9i/oradata/PROD/users03.dbf' online;
Database altered.
SQL> select name, status from v$datafile;
NAME STATUS


-------
/u01/ora9i/oradata/PROD/system01.dbf SYSTEM
/u01/ora9i/oradata/PROD/undotbs01.dbf ONLINE
/u01/ora9i/oradata/PROD/users01.dbf ONLINE
/u01/ora9i/oradata/PROD/users02.dbf ONLINE
/u01/ora9i/oradata/PROD/users03.dbf ONLINE
/u01/ora9i/oradata/PROD/example01.dbf ONLINE
6 rows selected.

SQL> select tablespace_name, status from dba_tablespaces;
TABLESPACE_NAME STATUS


---------
SYSTEM ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
SQL> select * from v$recover_file;
no rows selected
SQL> select count(*) from hr.kkk;
COUNT(*)
438272
Posted by redkite
, |

ORA-00031: session marked for kill 의 해결책

 

 

[TroubleShootings]

테이블이 락이 걸려서 TOAD의 사용이 막힌 경우 테이블의 락을 풀어줘야 하는데, 보통은 SYSTEM 계정으로 접근하여 아래와 같은 쿼리를 입력하면 테이블의 락이 해제된다.
 
ALTER SYSTEM KILL SESSION '16,4558';
 (* ALTER SYSTEM KILL SESSION 'SID_no,SERIAL_no';)
 

하지만, 테이블 락을 해제 쿼리를 입력하여도 ORA-00031 : session marked for kill 의 메시지가 나오는 경우 직접적으로 아래의 쿼리를 이용하여 oracle계정으로 시스템에 접근하여 프로세스를 kill하는 방법이 있다.
 (kill을 하여도 락이 해제가 되지 않고, 앞서 session marked for kill이라는 메시지만 출력 되는 이유는 rollback을 하는 프로세스가 동작하여 kill을 해도 mark만 하고 rollback 중인 상태이므로 현재 락은 걸린 상태라고 볼 수 있을 것 같다.)
 

select vs.sid, vs.username, vs.osuser, vs.process fg_pid,
vp.spid bg_pid
from v$session vs, v$process vp
where vs.paddr = vp.addr;
위의 쿼리를 실행하여, PID(ProcessID)를 확인 후 오라클 계정으로 시스템에 접근하여, kill명령어를 이용하여 해당 프로세스를 종료한다.
 
$ kill -9 pid
 
물론 앞서 메시지가 나오고 방금 kill이 안되는 경우에도 어느정도 시간을 갖고 기다리면 rollback segment의 수치가 점점 작아져 결국 테이블 락이 해제가 된다.
 

 

Posted by redkite
, |

- 'PLAN_TABLE' is old version

 

SQL> drop table plan_table;

 

@/oracle/product/10.2.0/db_1/rdbms/admin/utlxplan.sql

Posted by redkite
, |

테이블에 CLOB 타입이 포함된 dmp 파일을 import 하고자 할때.


다음과 같은 오류가 발생할수 있다.

IMP-00017: following statement failed with ORACLE error 959:
...
...
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'TS_ICMS_DATA' does not exist


import의 경우 컬럼에 CLOB 데이터타입이 포함되어 있을경우는 export받은 테이블의 테이블스페이스 정보와 import 하려고 하는 테이블스페이스가 같아야 한다.

따라서 다음과 같이 테이블 스페이스를 추가한다.

# tablespace 생성
CREATE TABLESPACE TS_ICMS_DATA

DATAFILE '/export/home/oracle/data/ICMSDATA1.dbf' SIZE 1000M;

# 사용자에게 테이블스페이스 지정
CREATE USER test_user IDENTIFIED BY test_pwd DEFAULT TABLESPACE ts_icms_data TEMPORARY TABLESPACE tmp;

# 권한부여
GRANT CONNECT, RESOURCE TO test_user;

Posted by redkite
, |

select tablespace_name, bytes, max_bytes
from user_ts_quotas;

Solution : SQL> Alter user AVS quota unlimited on USR_D;
SQL> alter user AVS quota <size> on USR_D;

Posted by redkite
, |

0003. LOCK object 확인

select do.OWNER, do.OBJECT_NAME, do.OBJECT_ID,
lo.SESSION_ID, lo.ORACLE_USERNAME, lo.OS_USER_NAME,
lo.PROCESS, lo.LOCKED_MODE
from dba_objects do, v$locked_object lo
where do.OBJECT_ID = lo.OBJECT_ID
and do.OWNER = 'IBFUSR'
and do.OBJECT_NAME = 'BT_TAB_SYNC_INFO';

OWNER
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_ID SESSION_ID ORACLE_USERNAME
---------- ---------- ------------------------------
OS_USER_NAME PROCESS LOCKED_MODE
------------------------------ ------------ -----------
IBFUSR
BT_TAB_SYNC_INFO
125142 66 IBFUSR
안민혁 2952:852 3

select SID, SERIAL# from v$session where sid = 66;

SID SERIAL#
---------- ----------
66 48801

alter system kill session '66,48801';
ALTER SYSTEM KILL SESSION '66,48801' IMMEDIATE;
ALTER SYSTEM DISCONNECT SESSION '66,48801' IMMEDIATE;

Situation 1

To check objects currently being used, e.g. by a DML statement, before executing a DDL command, you can query v$locked_object as in the example below.


Session A

SQL> connect miles/oracle;
Connected.

SQL> drop table test;

Table dropped.

SQL> create table test (a number);

Table created.

SQL> insert into test values (1);

1 row created.



Session B

SQL> connect / as sysdba
Connected.

SQL> truncate table miles.test;
truncate table miles.test
*
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
--> this is expected because miles.test is locked in Session A


SQL>
select do.OWNER, do.OBJECT_NAME, do.OBJECT_ID,
lo.SESSION_ID, lo.ORACLE_USERNAME, lo.OS_USER_NAME,
lo.PROCESS, lo.LOCKED_MODE
from dba_objects do, v$locked_object lo
where do.OBJECT_ID = lo.OBJECT_ID
and do.OWNER = 'MILES'
and do.OBJECT_NAME = 'TEST';


OWNER OBJECT_NAME OBJECT_ID SESSION_ID ORACLE_USERNAME
-------- ------------ ---------- ---------- ------------------------------
OS_USER_NAME PROCESS LOCKED_MODE
-------------------- -------------- -----------
MILES TEST 63754 1079 MILES
oracle 23013 3



From above, you can see miles.test is locked by Oracle user 'MILES' with OS user name 'oracle'.
Session id is 1079, OS process id is 23013.


You can kill the session to release the lock.

SQL> select SID, SERIAL# from v$session where sid = 1079;

SID SERIAL#
---------- ----------
1079 663


SQL> alter system kill session '1079,663';

System altered.



Then the DDL can be executed successfully:

SQL> truncate table miles.test;

Table truncated.

 

Situation 2

If a DDL statement on an object, e.g. create or replace procedure, is hanging because another user is executing the procedure, you can find the blocking session as in the example below.

Using 3 sessions:

  1. Session A: connect as sysdba
  2. Session B: connect as user rob/rob
  3. Session C: connect as user tony/tony


Session A

SQL>
connect / as sysdba
create user rob identified by rob;
grant connect, resource to rob;
create user tony identified by tony;
grant connect, resource to tony;
grant execute on dbms_lock to rob;
grant execute on dbms_lock to tony;



Session B

SQL>
connect rob/rob

create or replace procedure rob_test_p1 is
begin
null;
end;
/

grant execute on rob_test_p1 to tony;



Session C

SQL>
connect tony/tony
begin
rob.rob_test_p1;
dbms_lock.sleep(120);
end;
/



Session A

SQL>
connect / as sysdba

SQL>
select distinct ses.ksusenum sid, ses.ksuseser serial#,
ob.kglnaobj obj_name, ob.KGLNAOWN obj_owner,
ses.KSUUDNAM cur_user
from x$kglpn pn, x$kglob ob, x$ksuse ses
where ob.KGLNAOBJ='ROB_TEST_P1'
and (ob.KGLHDPMD <> 0
or
(ob.KGLHDPMD = 0 and ob.KGLHDLMD not in (0,1))
)
and ob.kglhdadr = pn.kglpnhdl
and pn.kglpnuse = ses.addr;

SID SERIAL# OBJ_NAME OBJ_OWNER CUR_USER
---------- ---------- -------------------- --------------- ------------------
1094 5909 ROB_TEST_P1 ROB TONY


SQL>
select sql_text
from v$sql a, v$session b
where a.sql_id=b.sql_id
and b.serial#=5909;

SQL_TEXT
--------------------------------------------------------------------------------
begin rob.rob_test_p1; dbms_lock.sleep(120); end;



If the DDL is already hanging due to a lock, you can follow below test case to find the lock details.

Session C

SQL> connect tony/tony

SQL>
begin
rob.rob_test_p1;
dbms_lock.sleep(120);
end;
/



Session B

SQL> connect rob/rob

SQL> alter procedure rob_test_p1 compile;
--> This is hanging



Session A

col obj_name format a30
col pin_cnt format 999
col pin_mode format 999
col pin_req format 999
col state format a30
col event format a30
col wait_time format 999999999
col seconds_in_wait format 999999999

SQL>
select distinct ses.ksusenum sid, ses.ksuseser serial#,
ob.kglnaobj obj_name,
pn.kglpncnt pin_cnt, pn.kglpnmod pin_mode, pn.kglpnreq pin_req,
w.state, w.event, w.wait_time, w.seconds_in_Wait
from x$kglpn pn, x$kglob ob, x$ksuse ses, v$session_wait w
where pn.kglpnhdl in (select kglpnhdl from x$kglpn where kglpnreq > 0)
and ob.kglhdadr = pn.kglpnhdl
and pn.kglpnuse = ses.addr
and w.sid = ses.indx
order by seconds_in_wait desc;


SID SERIAL# OBJ_NAME PIN_CNT PIN_MODE PIN_REQ
---------- ---------- ------------------------------ ------- -------- -------
STATE EVENT WAIT_TIME
------------------------------ ------------------------------ ----------
SECONDS_IN_WAIT
---------------
1082 6765 ROB_TEST_P1 3 2 0
WAITING PL/SQL lock timer 0
39

1074 6060 ROB_TEST_P1 0 0 3
WAITING library cache pin 0
27


SQL>
select sql_text
from v$sql a, v$session b
where a.sql_id=b.sql_id
and b.serial#=6765;

SQL_TEXT
--------------------------------------------------------------------------------
begin rob_test_p1; dbms_lock.sleep(120); end;


SQL>
select sql_text
from v$sql a, v$session b
where a.sql_id=b.sql_id
and b.serial#=6060;

SQL_TEXT
--------------------------------------------------------------------------------
alter procedure rob_test_p1 compile

Posted by redkite
, |

SQL> conn /as sysdba
ERROR:
ORA-09925: Unable to create audit trail file
IBM AIX RISC System/6000 Error: 13: Permission denied
Additional information: 9925
ORA-09925: Unable to create audit trail file
IBM AIX RISC System/6000 Error: 13: Permission denied
Additional information: 9925

---------------------------------------------------------------------------

1. init<sid>.ora <parameter:AUDIT_FILE_DEST> 존재 확인

2. $ORACLE_HOME/rdbms/audit 스페이스 확보 full 이면 데이터 임시 폴더로 MOVE

3. $ORACLE_HOME/bin/oracle permission 6755 인지 확인
아니면 chmod 6755 oracle

Posted by redkite
, |

0001. Undo Segment 삭제 방법

ORA-01552 ORA-00376 ORA-01110 ORA-01548 - UNDO tablespace

 

Recently our Helpdesk people configured backup on Payroll server. while running the backup, backup applications locking the writing file.for that issue alert log showing errors like below:

Mon Jul 06 05:07:36 2009
KCF: write/open error block=0x6f6 online=1
file=2 D:\ORACLE9\PRODUCT\PAYROLL\ORADATA\PAYROLL9\UNDOTBS01.DBF
error=27072 txt: 'OSD-04008: WriteFile() failure, unable to write to file
O/S-Error: (OS 33) The process cannot access the file because another process has locked a portion of the file.'
Automatic datafile offline due to write error on
file 2: D:\ORACLE9\PRODUCT\PAYROLL\ORADATA\PAYROLL9\UNDOTBS01.DBF
Mon Jul 06 05:07:36 2009
Errors in file d:\oracle9\product\payroll\admin\payroll9\bdump\payroll9_smon_2700.trc:
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: 'D:\ORACLE9\PRODUCT\PAYROLL\ORADATA\PAYROLL9\UNDOTBS01.DBF'


Immediately we stopped the backup & restarted the database .
Still the Application is not working. Application show error message

 

"ORA-01552: cannot use system rollback segment for non-system tablespace"

then I checked for the corrupted rollback segments

SQL>select segment_name,status,tablespace_name from dba_rollback_segs where status='NEEDS RECOVERY';
SEGMENT_NAME STATUS TABLESPACE_NAME
------------------------------ ---------------- -----------------
_SYSSMU1$ NEEDS RECOVERY UNDOTBS1
_SYSSMU2$ NEEDS RECOVERY UNDOTBS1
_SYSSMU3$ NEEDS RECOVERY UNDOTBS1
_SYSSMU4$ NEEDS RECOVERY UNDOTBS1
_SYSSMU5$ NEEDS RECOVERY UNDOTBS1
_SYSSMU6$ NEEDS RECOVERY UNDOTBS1
_SYSSMU7$ NEEDS RECOVERY UNDOTBS1
_SYSSMU8$ NEEDS RECOVERY UNDOTBS1
_SYSSMU9$ NEEDS RECOVERY UNDOTBS1
_SYSSMU10$ NEEDS RECOVERY UNDOTBS1

then I recreated another tablespace as UNDOTBS2

CREATE UNDO TABLESPACE "UNDOTBS2"
DATAFILE 'D:\ORACLE9\PRODUCT\PAYROLL\ORADATA\PAYROLL9\UNDOTBS02.DBF' SIZE 200M REUSE
AUTOEXTEND ON NEXT 51200K MAXSIZE 800M;

ALTER SYSTEM SET undo_tablespace=UNDOTBS2 SCOPE=BOTH;


Now I try to drop the old UNDO tablespace but it's giving error:

ora-01548 active rollback segment found

Now the issue is resolved but in Alert log we are getting errors like:

Wed Jul 15 11:50:52 2009
SMON: about to recover undo segment 1
SMON: mark undo segment 1 as needs recovery
……..
SMON: about to recover undo segment 10
SMON: mark undo segment 10 as needs recovery


& for some transactions from applications we are getting some more errors:


ORA-00376: file 2 cannot be read at this tme ORA-01110: data file 2: 'D:\ORACLE9\PRODUCT\PAYROLL\ORADATA\PAYROLL9\UNDOTBS01.DBF'


Solution:
1. create pfile from spfile;

2. Add the following line to pfile:


_corrupted_rollback_segments =('_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$',
'_SYSSMU5$','_SYSSMU6$','_SYSSMU7$','_SYSSMU8$','_SYSSMU9$','_SYSSMU10$')

_OFFLINE_ROLLBACK_SEGMENTS=('_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$','_SYSSMU5$','_SYSSMU6$','_SYSSMU7$','_SYSSMU8$','_SYSSMU9$','_SYSSMU10$')

3. comment undo management-Auto


#undo_management=AUTO

4. create spfile from pfile

5. Start the database again:


SQL> STARTUP RESTRICT

6. Drop bad rollback segments


SQL> drop rollback segment "_SYSSMU11$";
Rollback segment dropped.
......
SQL> drop rollback segment "_SYSSMU10$";
Rollback segment dropped.

7. Check again


SQL> select segment_name,status,tablespace_name from dba_rollback_segs where status='NEEDS RECOVERY';

No rows returned

8. DROP TABLESPACE undotbs1 INCLUDING CONTENTS AND DATAFILES ;

9. shutdown immedaite

10. remove added lines & comments from pfile and recreate the spfile

11.startup

Now the issue is resolved.

 

 

SELECT tablespace_name,status FROM dba_rollback_segs;


select segment_name, tablespace_name, status from dba_rollback_segs order by 2;

 

Response 폴더 clientadmin.rsp 파일을 연다.


#------------------------------------------------------------------------------
#Name : ORACLE_HOME
#Datatype : String
#Description: Complete path of the Oracle Home.
#Example : ORACLE_HOME = "/product/10.2.0/client"
#------------------------------------------------------------------------------
ORACLE_HOME="c:\oracle\product\10.2.0\client"

#------------------------------------------------------------------------------
#Name : ORACLE_HOME_NAME
#Datatype : String
#Description: Oracle Home Name. Used in creating folders and services.
#Example : ORACLE_HOME_NAME = "OraClient10ghome1"
#------------------------------------------------------------------------------
ORACLE_HOME_NAME="OraClient10ghome1"

위와 같이 수정한다

그런다음

실행창에서 cmd.exe 입력하여 커멘드 창을 실행 폴더로 이동한다음

setup.exe -silent -responsefile D:\Download\Oracle\Response\clientadmin.rsp

아래와 같이 입력하고 실행 하면 콘솔창에서 oracle 설치된다.

PATCH
/data/oracle/Disk1/stage/products.xml

 

커널 파라미터 설정

# cd /proc/sys/kernel
# echo 2147483648 > shmmax

# vi /etc/sysctl.conf

fs.file-max = 65536
kernel.shmmax = 2147483648
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range= 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144

# sysctl -p

참고 : kernel_parameter.rar

-----------------

CentOS 5.2 지원하지 않으므로 레드햇 4 수정.

# vi /etc/redhat-release

Red Hat Enterprise Linux AS release 4 (Taroon)

-----------------

매뉴얼이 제공하는 값과는 다르다.
다른 머신에 설치된 값을 참고했다.

# vi /etc/security/limits.conf

oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

참고 : Shell_Limits.rar

-----------------

# SELINUX=disabled

-----------------

적당히 최신 버전을 설치한다.

# rpm -Uvh setarch-2*
# rpm -Uvh make-3*
# rpm -Uvh glibc-2*
# rpm -Uvh libaio-0*

# rpm -Uvh compat-libstdc++-33-3*
# rpm -Uvh compat-gcc-34-3*
# rpm -Uvh compat-gcc-34-c++-3*
# rpm -Uvh gcc-4*
# rpm -Uvh libXp-1.0.0-8.1.el5.x86_64.rpm
# rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm

# rpm -Uvh openmotif-2*
# rpm -Uvh compat-db-4*

-------------------

그룹과 유저 생성

# groupadd oinstall
# groupadd dba
# groupadd oper

# useradd -g oinstall -G dba oracle
# passwd oracle

-------------------

설치 디렉토리 생성.
# mkdir -p /u01/app/oracle/product/10.2.0/db_1
# chown -R oracle.oinstall /u01

-------------------

베이스 디렉토리, 디렉토리, 라이브러리 경로 설정

# su - oracle
$ vi .bash_profile

export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

-------------------

오라클 설치 파일의 압축을 푼다.

$ gzip -d 10201_database_linux_x86_64.cpio.gz
$ cpio -idmvc < 10201_database_linux_x86_64.cpio

-------------------

다음은 오라클 인스톨러를 사일런트 모드로 실행하기 위한 작업이다.

oraInst.loc 파일을 수통 생성한다.

# su -
# cd /etc
# vi oraInst.loc

inventory_loc=/u01/app/oracle/oraInventory
inst_group=

# chown oracle:oinstall oraInst.loc
# chmod 664 oraInst.loc

---------------------

리스폰스 파일 수정, 엔터프라이즈의 다음 항목만 수정했다.

# vi /home/oracle/database/response/enterprise.rsp

ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
ORACLE_HOME_NAME=orcl

---------------------

# su - oracle

./runInstaller -silent -responseFile /home/oracle/database/response/enterprise.rsp

글자가 마구 깨져나왔다.

설치 디렉토리를 삭제하고 재성성, 재권한설정을 한다.

$ echo $LANG
$ ko_KR.UTF-8

$ LANG=en_US.UTF-8

재실행, 설치가 완료되었다면 root.sh 실행한다.

$ su -
# /$ORACLE_HOME/root.sh

---------------------

사일런트 모드로 인스톨을 했다면 NetCA DBCA 따로 셋팅해 주어야 한다.
$ vi /home/oracle/database/response/netca.rsp

수정 다음과 같이 실행한다.

$ $ORACLE_HOME/bin/netca /silent /responsefile /local_dir/netca.rsp

DBCA 비슷하다.

$ vi /local_dir/dbca.rsp

$ $ORACLE_HOME/bin/dbca {-progressOnly | -silent} [-cloneTemplate] [-datafileDestination /datafilepath] -responseFile /local_dir/dbca.rsp

---------------------

마지막으로 listener.ora, tnsname.ora 셋팅하고 리스너를 켜봅시다.
$ cd $ORACLE_HOME/network/admin/

예제:
listener.ora tnsnames.ora

$ lsnrctl start

리스너 상태 확인
$lsnrctl status

문자셋을 확인하자.->따로 포스팅 되어있다.

### 신규 롤백 테이블 생성 ###
CREATE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/data1/oradata/COSS/undotbs02.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 200M;

### 신규 테이블로 변경 ###
ALTER SYSTEM SET undo_tablespace=UNDOTBS2 SCOPE=BOTH;

### UNDO 테이블 확인 ###
SELECT tablespace_name,status FROM dba_rollback_segs;

### 온/오프라인 확인 ###
select segment_name, tablespace_name, status from dba_rollback_segs order by 2;

### 테이블 스페이스 드랍 ###
DROP TABLESPACE undotbs1 INCLUDING CONTENTS AND DATAFILES;

### 이전 테이블로 변경하기 위한 테이블스페이스 생성 ###
CREATE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/data1/oradata/COSS/undotbs01.dbf' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 200M;

### 이전 테이블로 변경 ###
ALTER SYSTEM SET undo_tablespace=UNDOTBS1 SCOPE=BOTH;

### 온/오프라인 확인 ###
select segment_name, tablespace_name, status from dba_rollback_segs order by 2;

### 신규 테이블 스페이스 드랍 ###
DROP TABLESPACE undotbs2 INCLUDING CONTENTS AND DATAFILES;

Posted by redkite
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함