이전
SQL> create tablescott.helei tablespace system as select * from scott.emp;
truncatetable scott.helei;
SQL> selecttable_name,tablespace_name,blocks,pct_free,pct_used from dba_tables wheretable_name='HELEI';
TABLE_NAME TABLESPACE_NAME BLOCKS PCT_FREE PCT_USED
------------------------------------------------------------ ---------- ---------- ----------
HELEI SYSTEM 10 40
2. 그리고 우 리 는 pctfree 를 0 으로 설정 합 니 다.
SQL> alter table scott.helei pctfree 0;
3. 이때 우 리 는 표 에 데 이 터 를 삽입 합 니 다.
SQL> insert intoscott.helei select * from scott.helei;
14 rows created.
SQL> /
28 rows created.
SQL> /
56 rows created.
SQL> /
112 rows created.
SQL> /
224 rows created.
SQL> /
448 rows created.
SQL> /
896 rows created.
SQL> /
1792 rows created.
SQL> /
3584 rows created.
4. 이때 우리 표 는 업 데 이 트 를 해 야 이동 하 는 상황 이 발생 한다.
SQL> updatescott.helei set comm=10000,job='hhhhh',ename='hhhhh';
7168 rows updated.
SQL> commit;
Commit complete.
5. 이 시 계 를 분석 해 봅 시다.
SQL> analyzetable scott.helei compute statistics;
Table analyzed.
6. 이때 우 리 는 이 시계 가 이동 하 는 상황 이 발생 했 는 지 살 펴 볼 수 있다.
SQL> selecttable_name,tablespace_name,num_rows,avg_row_len,chain_cnt from dba_tables wheretable_name='HELEI';
TABLE_NAME TABLESPACE_NAME NUM_ROWSAVG_ROW_LEN CHAIN_CNT
------------------------------------------------------------ ---------- ----------- ----------
HELEI SYSTEM 7168 40 3
CHAIN 을 볼 수 있 습 니 다.CNT 의 열 은 0 이 아니 라 3 은 행 이동 이 존재 한 다 는 것 을 설명 합 니 다. CHAINCNT 는 행 링크 와 행 이동 의 총액 이다.즉, 3 안에 줄 링크 나 줄 이동 이 있 을 수 있다 는 뜻 이다. 물론 이다.우리 에 게 는 행 링크 가 존재 하지 않 을 것 이다. 왜냐하면 이때 우리 가 고의로 만 든 행 이전 실험 때문이다.
해결 방법
1. 우 리 는 먼저 데이터베이스 에 있다.각본 을 읽다.스 크 립 트 를 완 주 한 후에 우 리 는 스 크 립 트 를 완 주 한 후에 자동 으로 chained 라 는 것 을 만 들 수 있 습 니 다.rows 시계.
SQL>@?/rdbms/admin/utlchain
Tablecreated.
SQL>select count(*) from chained_rows;
COUNT(*)
----------
0
2. 이때 우 리 는 발생 한 줄 이전 데이터 베 이 스 를 chainedrows 표 에서
SQL>analyze table scott.helei list chained rows into chained_rows;
Tableanalyzed.
3. 그리고 chainedrows 이 시계.많은 데이터 베 이 스 를 볼 수 있다.그들 은 모두 이동 할 수 있 는 데이터베이스 이기 때문이다.
SQL>select * from chained_rows;
OWNER_NAME TABLE_NAME CLUSTER_NAME PARTITION_NAME SUBPARTITION_NAME HEAD_ROWID ANALYZE_TIME
------------------------------------------------------------ ------------------------------------------------------------ ------------------------------------------------ ------------
SCOTT HELEI N/A AAASNcAABAAAVCYAAA 17-JAN-16
SCOTT HELEI N/A AAASNcAABAAAVCjAAA 17-JAN-16
SCOTT HELEI N/A AAASNcAABAAAVCuAAA 17-JAN-16
4. 이때, 우 리 는 helei 라 는 시 계 를 만 들 었 다.bak 및 줄 이동 이 발생 한 데 이 터 를 helei 에 삽입 합 니 다.bak 중.
SQL> create table scott.helei_bak as select * fromscott.helei where rowid in (select head_rowid from chained_rows);
Tablecreated.
SQL>select count(*) from scott.helei_bak;
COUNT(*)
----------
3
5. 우 리 는 원래 표 에서 줄 이동 이 발생 한 데 이 터 를 모두 삭제 합 니 다.
SQL>delete from scott.helei where rowid in (select head_rowid from chained_rows);
3 rowsdeleted.
SQL>commit;
Commitcomplete.
6. 우리 다시 heleibak 의 데 이 터 는 원래 helei 표 에 삽입 되 어 있 습 니 다.
SQL>insert into scott.helei select * from scott.helei_bak;
3 rowscreated.
SQL>commit;
Commitcomplete.
7. 마지막.우 리 는 helei 를 분석 한 후에 아직 이전 할 수 있 는 지 확인 하고 있다.
SQL>analyze table scott.helei compute statistics;
Tableanalyzed.
SQL>select table_name,tablespace_name,num_rows,avg_row_len,chain_cnt,pct_free fromdba_tables where table_name ='HELEI';
TABLE_NAME TABLESPACE_NAME NUM_ROWSAVG_ROW_LEN CHAIN_CNT PCT_FREE
------------------------------------------------------------ ---------- ----------- ---------- ----------
HELEI
8. 마지막 으로 우 리 는 helei 이 시계의 chain 을 보 았 다.cnct 가 0 이 되 었 습 니 다. 이 표 는 줄 이동 이나 줄 링크 가 없 는 상황 을 의미 합 니 다.문제 가 결연 하 다.
요약: 줄 이전 검사 방법: 1) $ORACLE 실행HOME/rdbms/admin/utlchain.sql2)analyze table table_name list chained rows into CHAINED_ROWS3) select * from CHAINED_ROWS where table_name='table_name';제거 방법: 방법 1: create tablename_tmp as select * from table_name where rowed in (select head_rowid from chained_rows);Delete from table_name where rowed in (select head_rowid from chained_rows);Insert into table_name select * from table_name_tmp;방법 2: create tablename_tmp as select * from table_name ;truncate table table_nameinsert into table_name select * from table_name_tmp 방법 3: exp 도구 로 시 계 를 내 보 낸 다음 이 시 계 를 삭제 하고 마지막 으로 imp 도구 로 이 시 계 를 가 져 오 는 방법 4: alter tablename move tablespace tablespace_name, 그리고 다시 표 시 된 색인 위의 4 가지 방법 은 이미 존재 하 는 줄 이동 현상 을 없 애 는 데 사용 할 수 있 지만 줄 이동 이 많은 경우 에는 PCTFREE 매개 변수 설정 이 너무 작 아서 PCT 를 조정 해 야 합 니 다.FREE 매개 변수의 값.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Java 호출 Oracle 스토리지 프로세스 상세 정보Java 호출 Oracle 스토리지 프로세스 상세 정보 단계: 1. Oracle 스토리지 프로세스 작성 2. 데이터베이스 작성 연결 도구 클래스 얻기 3. 간단한 응용 프로그램 호출 저장 프로세스 작성 구현: 1. ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.