Â¥Ö÷: solearn

Drop columnʱΪʲôҪÓÐundo data?

[¸´ÖÆÁ´½Ó]
ÂÛ̳»ÕÕÂ:
1
ITPUBÐÂÊ×Ò³ÉÏÏß¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2007-10-20 08:38:44
11#
·¢±íÓÚ 2006-6-30 18:50 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ solearn ·¢²¼
[B]The following is the output:

Please look at where USN=21.

SQL> select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
         0       9200    1138688          0    1138688          0          0
         2       8136   10641408          0   10641408          0          0
         3       9930   10641408          0   10641408          0          0
         4      25288   10641408          0   10641408          0          0
         5      29692   10641408          0   10641408          0          0
         6       9232   10641408          0   10641408          0          0
         7       9722   10641408          0   10641408          0          0
         8       7844   10641408          0   10641408          0          0
         9       8994   10641408          0   10641408          0          0
        10       9134   10641408          0   10641408          0          0
        11       7874   10641408          0   10641408          0          0

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
        12       9810   10641408          0   10641408          0          0
        13      14188   10641408          0   10641408          0          0
        14    5758694   10641408          0   10641408          0          2
        15    4802186   10641408          0   10641408          0          2
        16       9346   10641408          0   10641408          0          0
        17       9454   10641408          0   10641408          0          0
        18      10324   10641408          0   10641408          0          0
        19      10738   10641408          0   10641408          0          0
        20      12442   10641408          0   10641408          0          0
        21       8398   10641408          0   10641408          0          0


SQL> desc ttt
Name                                      Null?    Type
----------------------------------------- -------- ---------------------------
OWNER                                              VARCHAR2(30)
OBJECT_NAME                                        VARCHAR2(128)
SUBOBJECT_NAME                                     VARCHAR2(30)
OBJECT_ID                                          NUMBER
OBJECT_TYPE                                        VARCHAR2(18)
CREATED                                            DATE
LAST_DDL_TIME                                      DATE
STATUS                                             VARCHAR2(7)
TEMPORARY                                          VARCHAR2(1)
GENERATED                                          VARCHAR2(1)
SECONDARY                                          VARCHAR2(1)

SQL> alter table ttt drop column last_ddl_time;

Table altered.

SQL>  select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
         0       9200    1138688          0    1138688          0          0
         2       8136   10641408          0   10641408          0          0
         3       9930   10641408          0   10641408          0          0
         4      25288   10641408          0   10641408          0          0
         5      29862   10641408          0   10641408          0          0
         6       9232   10641408          0   10641408          0          0
         7       9892   10641408          0   10641408          0          0
         8       7844   10641408          0   10641408          0          0
         9       8994   10641408          0   10641408          0          0
        10       9134   10641408          0   10641408          0          0
        11       7874   10641408          0   10641408          0          0

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
        12       9810   10641408          0   10641408          0          0
        13      14188   10641408          0   10641408          0          0
        14    5758694   10641408          0   10641408          0          2
        15    4802186   10641408          0   10641408          0          2
        16       9346   10641408          0   10641408          0          0
        17       9454   10641408          0   10641408          0          0
        18      10324   10641408          0   10641408          0          0
        19      10738   10641408          0   10641408          0          0
        20      12442   10641408          0   10641408          0          0
        21    5072080   10641408          0   10641408          0          2

21 rows selected. [/B]


ÎÒ²âÊÔÒ»ÏÂ,µ«ÊÇ,±íµÄ״̬²¢²»ÊÇinvalid ,ÔÚ±íÖдæÔÚ×Å´óÁ¿Êý¾ÝµÄÇé¿öÏÂ,Èç¹ûalter table   drop column µÄʱºò WRITES Òª±È²»´æÔÚÊý¾ÝµÄ¶øÖ±½Ó½øÐÐdrop column ´óµÃ¶à!

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
14
°ÂÔË»á¼ÍÄî»ÕÕÂ:×ÔÐгµ
ÈÕÆÚ:2008-04-25 21:00:142013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-10 13:11:14°ÂÔË»á¼ÍÄî»ÕÕÂ:Ƥ»®Í§¼¤Á÷»ØÐý
ÈÕÆÚ:2012-08-13 10:25:38ÏÊ»¨µ°
ÈÕÆÚ:2012-02-10 11:40:172010дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2010-03-01 11:04:58ÊÚȨ»áÔ±
ÈÕÆÚ:2010-01-12 09:40:47ITPUBÔªÀÏ
ÈÕÆÚ:2010-01-12 09:33:092009дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2009-01-04 14:52:28°ÂÔË»á¼ÍÄî»ÕÕÂ:È­»÷
ÈÕÆÚ:2008-10-24 13:22:33
12#
 Â¥Ö÷| ·¢±íÓÚ 2006-7-3 15:18 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ SONGHEFEI ·¢²¼
[B]

ÎÒ²âÊÔÒ»ÏÂ,µ«ÊÇ,±íµÄ״̬²¢²»ÊÇinvalid ,ÔÚ±íÖдæÔÚ×Å´óÁ¿Êý¾ÝµÄÇé¿öÏÂ,Èç¹ûalter table   drop column µÄʱºò WRITES Òª±È²»´æÔÚÊý¾ÝµÄ¶øÖ±½Ó½øÐÐdrop column ´óµÃ¶à! [/B]


ÄãÊÇÔõÑùÖ¤Ã÷±íµÄ״̬²»ÊÇinvalidµÄ£¿oracle 9i fundamental I ÉÏ˵µÄÕâʱ±íµÄ״̬ÊÇinvalid¡£

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
47
ÃÉÆæ¡¤D¡¤Â··É
ÈÕÆÚ:2017-03-27 08:04:23ÂíÉÏÓгµ
ÈÕÆÚ:2014-02-18 16:41:112014Äêдº¸£ÕÂ
ÈÕÆÚ:2014-02-18 16:41:11Ò»Æû
ÈÕÆÚ:2013-09-01 20:46:27¸´»îµ°
ÈÕÆÚ:2013-03-13 07:55:232013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-09 18:03:322012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:20
13#
·¢±íÓÚ 2006-7-4 12:39 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ solearn ·¢²¼
[B]
ÄãÊÇÔõÑùÖ¤Ã÷±íµÄ״̬²»ÊÇinvalidµÄ£¿oracle 9i fundamental I ÉÏ˵µÄÕâʱ±íµÄ״̬ÊÇinvalid¡£ [/B]


I'm not sure what you or SONGHEFEI mean here. Can you tell us where you read that? Are you talking about status column of user_objects? Or some column(s) of user_partial_drop_tabs, or user_unused_col_tabs? Where exactly is the invalid state or status?

Or you're talking about index status?

Yong Huang

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
14
°ÂÔË»á¼ÍÄî»ÕÕÂ:×ÔÐгµ
ÈÕÆÚ:2008-04-25 21:00:142013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-10 13:11:14°ÂÔË»á¼ÍÄî»ÕÕÂ:Ƥ»®Í§¼¤Á÷»ØÐý
ÈÕÆÚ:2012-08-13 10:25:38ÏÊ»¨µ°
ÈÕÆÚ:2012-02-10 11:40:172010дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2010-03-01 11:04:58ÊÚȨ»áÔ±
ÈÕÆÚ:2010-01-12 09:40:47ITPUBÔªÀÏ
ÈÕÆÚ:2010-01-12 09:33:092009дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2009-01-04 14:52:28°ÂÔË»á¼ÍÄî»ÕÕÂ:È­»÷
ÈÕÆÚ:2008-10-24 13:22:33
14#
 Â¥Ö÷| ·¢±íÓÚ 2006-7-4 14:04 | Ö»¿´¸Ã×÷Õß
That is from Oracle 9i fundamental I (d32643) page 351. It says the table is marked 'invalid' while column being dropped till the operation completes.

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
5
ÊÚȨ»áÔ±
ÈÕÆÚ:2005-10-30 17:05:33ÉúФ»ÕÕÂ2007°æ:¼¦
ÈÕÆÚ:2008-01-02 17:35:53ÉúФ»ÕÕÂ2007°æ:Êó
ÈÕÆÚ:2008-01-02 17:35:532015Äêдº¸£ÕÂ
ÈÕÆÚ:2015-03-04 14:19:112015Äêдº¸£ÕÂ
ÈÕÆÚ:2015-03-06 11:57:31
15#
·¢±íÓÚ 2006-7-4 16:12 | Ö»¿´¸Ã×÷Õß
Èç¹ûdrop column²Ù×÷Òì³£Öжϣ¬ÊÇÒª»Ø¹öµÄ¡£
³ý·ÇʹÓÃdrop column .. checkpoint¡¡ÊDz¿·Ýɾ³ý²Ù×÷£¨Ò»²¿·ÝÒ»²¿·ÝµÄÌá½»£©£¬¿ÉÒÔcontinue.

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
27
ÊÚȨ»áÔ±
ÈÕÆÚ:2005-10-30 17:05:33¹ÜÀíÍŶӳÉÔ±
ÈÕÆÚ:2011-05-07 01:45:082012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:11:362012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:11:362012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:11:362012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:11:362012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:11:36ÓÅÐãдÊÖ
ÈÕÆÚ:2013-12-18 09:29:13ÂíÉÏÓгµ
ÈÕÆÚ:2014-02-19 11:55:14ÂíÉÏÓз¿
ÈÕÆÚ:2014-02-19 11:55:14
16#
·¢±íÓÚ 2006-7-4 17:30 | Ö»¿´¸Ã×÷Õß
drop columnµÄʱºò»átouchÐÞ¸Äÿһ¸öblock

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
47
ÃÉÆæ¡¤D¡¤Â··É
ÈÕÆÚ:2017-03-27 08:04:23ÂíÉÏÓгµ
ÈÕÆÚ:2014-02-18 16:41:112014Äêдº¸£ÕÂ
ÈÕÆÚ:2014-02-18 16:41:11Ò»Æû
ÈÕÆÚ:2013-09-01 20:46:27¸´»îµ°
ÈÕÆÚ:2013-03-13 07:55:232013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-09 18:03:322012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:20
17#
·¢±íÓÚ 2006-7-5 11:15 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ solearn ·¢²¼
[B]That is from Oracle 9i fundamental I (d32643) page 351. It says the table is marked 'invalid' while column being dropped till the operation completes. [/B]


I don't have that document. But I find the words in SQL Reference documentation, where it says "if this statement [alter table drop column checkpoint] is interrupted after a checkpoint has been applied, then the table remains in an unusable state." It's interesting to know that a table can go into an *unusable* state. Calling it "invalid" is a little too far-fetched, because it would imply all_objects.status shows 'INVALID'. (I don't think a table would ever be INVALID in that sense.)

Yong Huang

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
14
°ÂÔË»á¼ÍÄî»ÕÕÂ:×ÔÐгµ
ÈÕÆÚ:2008-04-25 21:00:142013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-10 13:11:14°ÂÔË»á¼ÍÄî»ÕÕÂ:Ƥ»®Í§¼¤Á÷»ØÐý
ÈÕÆÚ:2012-08-13 10:25:38ÏÊ»¨µ°
ÈÕÆÚ:2012-02-10 11:40:172010дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2010-03-01 11:04:58ÊÚȨ»áÔ±
ÈÕÆÚ:2010-01-12 09:40:47ITPUBÔªÀÏ
ÈÕÆÚ:2010-01-12 09:33:092009дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2009-01-04 14:52:28°ÂÔË»á¼ÍÄî»ÕÕÂ:È­»÷
ÈÕÆÚ:2008-10-24 13:22:33
18#
 Â¥Ö÷| ·¢±íÓÚ 2006-7-6 08:43 | Ö»¿´¸Ã×÷Õß
That extracted from Oracle 9i DBA fundamentals I students guide :

SLIDE
_________________________________________________________________________________
ALTER TABLE hr.employees
DROP COLUMN comments
CASCADE CONSTRANITS CHECKPOINT 1000;
_________________________________________________________________________________

While dropping columns from large tables, checkpoints can be specified to minimize the use of undo space. In the example in the slide, a checkpoint occurs every 1,000 rows. The table is marked INVALID until the operation completes. If the instance fails during the operation, the table remains INVALID on start up, and the operation will have to be completed.

Use the following statement to resume an interrupted drop operation:

ALTER TABLE hr.employees
DROP COLUMNS CONTINUES;

Use of this will generate an error if the table is in a valid state.


I did a test as followed:

SQL> select status from all_objects where object_name = 'TTT' ;

STATUS
-------
VALID

In another session, did:

SQL> alter table ttt drop column subobject_name checkpoint 1000;

Before the "Table altered" turned out,  checked "ttt" table status:

SQL> select status from all_objects where object_name = 'TTT' ;

STATUS
-------
VALID


As the output above, I could not see a "INVALID" state on table "ttt".

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
47
ÃÉÆæ¡¤D¡¤Â··É
ÈÕÆÚ:2017-03-27 08:04:23ÂíÉÏÓгµ
ÈÕÆÚ:2014-02-18 16:41:112014Äêдº¸£ÕÂ
ÈÕÆÚ:2014-02-18 16:41:11Ò»Æû
ÈÕÆÚ:2013-09-01 20:46:27¸´»îµ°
ÈÕÆÚ:2013-03-13 07:55:232013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-09 18:03:322012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:202012дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-02-13 15:13:20
19#
·¢±íÓÚ 2006-7-14 03:34 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ solearn ·¢²¼
[B]The following is the output:

Please look at where USN=21.

SQL> select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
         0       9200    1138688          0    1138688          0          0
...
        21       8398   10641408          0   10641408          0          0

...
SQL> alter table ttt drop column last_ddl_time;

Table altered.

SQL>  select usn,writes,rssize,xacts,hwmsize,shrinks,wraps from v$rollstat;

       USN     WRITES     RSSIZE      XACTS    HWMSIZE    SHRINKS      WRAPS
---------- ---------- ---------- ---------- ---------- ---------- ----------
         0       9200    1138688          0    1138688          0          0
...
        21    5072080   10641408          0   10641408          0          2

21 rows selected. [/B]


If I implied that system rollback segment was only meant for Oracle's internal operation (i.e. recursive SQL), I was wrong. Oracle decides which rollback segment to use based on a set of rules. I remember seeing all the rules in Rama Velpuri's book "Oracle Backup and Recovery" (probably within the first 50 pages). System rollback segment is way down the list. It's NOT exclusively used to record data dictionary changes (i.e. recursive calls).

Yong Huang

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´
ÂÛ̳»ÕÕÂ:
14
°ÂÔË»á¼ÍÄî»ÕÕÂ:×ÔÐгµ
ÈÕÆÚ:2008-04-25 21:00:142013Äêдº¸£ÕÂ
ÈÕÆÚ:2013-02-25 14:51:24ITPUB 11ÖÜÄê¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2012-10-10 13:11:14°ÂÔË»á¼ÍÄî»ÕÕÂ:Ƥ»®Í§¼¤Á÷»ØÐý
ÈÕÆÚ:2012-08-13 10:25:38ÏÊ»¨µ°
ÈÕÆÚ:2012-02-10 11:40:172010дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2010-03-01 11:04:58ÊÚȨ»áÔ±
ÈÕÆÚ:2010-01-12 09:40:47ITPUBÔªÀÏ
ÈÕÆÚ:2010-01-12 09:33:092009дº¼ÍÄî»ÕÕÂ
ÈÕÆÚ:2009-01-04 14:52:28°ÂÔË»á¼ÍÄî»ÕÕÂ:È­»÷
ÈÕÆÚ:2008-10-24 13:22:33
20#
 Â¥Ö÷| ·¢±íÓÚ 2006-7-14 14:09 | Ö»¿´¸Ã×÷Õß
×î³õÓÉ eagle_fan ·¢²¼
[B]drop columnµÄʱºò»átouchÐÞ¸Äÿһ¸öblock [/B]


TOUCHÊÇָʲôÒâË¼ÄØ£¿ÔÚdrop columnʱ£¬ÊÇÕÒµ½Ã¿Ò»ÐнøÐиüÐÂÂð£¿

ʹÓõÀ¾ß ¾Ù±¨

»Ø¸´

ÄúÐèÒªµÇ¼ºó²Å¿ÉÒÔ»ØÌû µÇ¼ | ×¢²á

±¾°æ»ý·Ö¹æÔò ·¢±í»Ø¸´

TOP¼¼Êõ»ý·Ö°ñ ÉçÇø»ý·Ö°ñ »ÕÕ ÍÅ¶Ó Í³¼Æ ֪ʶË÷ÒýÊ÷ »ý·Ö¾ºÅÄ Îı¾Ä£Ê½ °ïÖú
  ITPUBÊ×Ò³ | ITPUBÂÛ̳ | Êý¾Ý¿â¼¼Êõ | ÆóÒµÐÅÏ¢»¯ | ¿ª·¢¼¼Êõ | ΢Èí¼¼Êõ | Èí¼þ¹¤³ÌÓëÏîÄ¿¹ÜÀí | IBM¼¼ÊõÔ°µØ | ÐÐÒµ×ÝÏòÌÖÂÛ | ITÕÐÆ¸ | ITÎĵµ
  ChinaUnix | ChinaUnix²©¿Í | ChinaUnixÂÛ̳
CopyRight 1999-2011 itpub.net All Right Reserved. ±±¾©Ê¢ÍØÓÅѶÐÅÏ¢¼¼ÊõÓÐÏÞ¹«Ë¾°æÈ¨ËùÓС¡ÁªÏµÎÒÃÇ Î´³ÉÄêÈ˾ٱ¨×¨Çø¡¡
¾©ICP±¸16024965ºÅ-8 ¡¡±±¾©Êй«°²¾Öº£µí·Ö¾ÖÍø¼àÖÐÐı¸°¸±àºÅ£º11010802021510¡¡¹ã²¥µçÊÓ½ÚÄ¿ÖÆ×÷¾­ÓªÐí¿ÉÖ¤£º±àºÅ£¨¾©£©×ÖµÚ1149ºÅ
  
¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí