<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    筆頭。。
    實踐啟示
    posts - 14,comments - 3,trackbacks - 0

    My Oracle Cook Book-來自oralce菜鳥的學習筆記

    準備

    用到的是oracle自帶的用戶和表
    用戶為scott/tiger
    步驟是:連接數據庫
    -> sqlplus scott/tiger
    Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0
    Connected as scott.

    初始認證用戶

    如果scott用戶沒有鏈接到數據庫,
    通過數據庫認證查看用戶的帳號狀態,有可能是scott用戶的狀態處于EXPIRED & LOCKED

    1-1   顯示所有用戶的帳號狀態

    以sysdba用戶登錄:
    ->sqlplus / as sysdba
    查看所有用戶的帳號狀態查找的表為dba_users(視圖);
    SQL> desc dba_users;
    Name                        Type           Nullable Default Comments                                
    --------------------------- -------------- -------- ------- ---------------------------------------
    USERNAME                    VARCHAR2(30)                    Name of the user                        
    USER_ID                     NUMBER                          ID number of the user                   
    PASSWORD                    VARCHAR2(30)   Y                Encrypted password                      
    ACCOUNT_STATUS              VARCHAR2(32)                                                            
    LOCK_DATE                   DATE           Y                                                        
    EXPIRY_DATE                 DATE           Y                                                        
    DEFAULT_TABLESPACE          VARCHAR2(30)                    Default tablespace for data             
    TEMPORARY_TABLESPACE        VARCHAR2(30)                    Default tablespace for temporary tables
    CREATED                     DATE                            User creation date                      
    PROFILE                     VARCHAR2(30)                    User resource profile name              
    INITIAL_RSRC_CONSUMER_GROUP VARCHAR2(30)   Y                User's initial consumer group           
    EXTERNAL_NAME               VARCHAR2(4000) Y                User external name                      

    (需要的表字段用紅色標識)
    SQL> select username,account_status from dba_users where username like 'S%';
     
    USERNAME                       ACCOUNT_STATUS
    ------------------------------ --------------------------------
    SYSMAN                         OPEN
    SYS                            OPEN
    SYSTEM                         OPEN
    SI_INFORMTN_SCHEMA             EXPIRED & LOCKED
    SCOTT                      EXPIRED & LOCKED
    SH                             EXPIRED & LOCKED
    注意scott用戶的account_status狀態
    expired意思是用戶的密碼過期了。
    Locked意思是用戶帳號已經鎖定

    1.2 解鎖用戶和處理用戶密碼過期

    SQL> alter user scott identified by tiger account unlock;
     
    User altered
     
    SQL> select username,account_status from dba_users where username like 'S%';

     
    USERNAME                       ACCOUNT_STATUS
    ------------------------------ --------------------------------
    SCOTT                          OPEN
    SYSMAN                         OPEN
    SYS                            OPEN
    SYSTEM                         OPEN
    SI_INFORMTN_SCHEMA             EXPIRED & LOCKED
    SH                             EXPIRED & LOCKED
     
    6 rows selected
    注意scott狀態已經打開
    語句alter user scott identified by tiger account unlock;其中identified by tiger更新了密碼,account unlock 解鎖了scott用戶
    注意狀態為OPEN狀態
    以scott用戶登錄
    SQL> conn scott/tiger
    Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0
    Connected as scott


    1.3查看用戶下的表(user_tables視圖)

    SQL> desc user_tables;
    Name                      Type         Nullable Default Comments                                                                                   
    ------------------------- ------------ -------- ------- ------------------------------------------------------------------------------------------
    TABLE_NAME                VARCHAR2(30)                  Name of the table                                                                          
    TABLESPACE_NAME           VARCHAR2(30) Y                Name of the tablespace containing the table                                                
    CLUSTER_NAME              VARCHAR2(30) Y                Name of the cluster, if any, to which the table belongs                                    
    IOT_NAME                  VARCHAR2(30) Y                Name of the index-only table, if any, to which the overflow or mapping table entry belongs
    PCT_FREE                  NUMBER       Y                Minimum percentage of free space in a block                                                
    PCT_USED                  NUMBER       Y                Minimum percentage of used space in a block                                                
    INI_TRANS                 NUMBER       Y                Initial number of transactions                                                             
    MAX_TRANS                 NUMBER       Y                Maximum number of transactions                                                             
    INITIAL_EXTENT            NUMBER       Y                Size of the initial extent in bytes                                                        
    NEXT_EXTENT               NUMBER       Y                Size of secondary extents in bytes                                                         
    MIN_EXTENTS               NUMBER       Y                Minimum number of extents allowed in the segment                                           
    MAX_EXTENTS               NUMBER       Y                Maximum number of extents allowed in the segment                                           
    PCT_INCREASE              NUMBER       Y                Percentage increase in extent size                                                         
    FREELISTS                 NUMBER       Y                Number of process freelists allocated in this segment                                      
    FREELIST_GROUPS           NUMBER       Y                Number of freelist groups allocated in this segment                                        
    LOGGING                   VARCHAR2(3)  Y                Logging attribute                                                                          
    BACKED_UP                 VARCHAR2(1)  Y                Has table been backed up since last modification?                                          
    NUM_ROWS                  NUMBER       Y                The number of rows in the table                                                            
    BLOCKS                    NUMBER       Y                The number of used blocks in the table                                                     
    EMPTY_BLOCKS              NUMBER       Y                The number of empty (never used) blocks in the table                                       
    AVG_SPACE                 NUMBER       Y                The average available free space in the table                                              
    CHAIN_CNT                 NUMBER       Y                The number of chained rows in the table                                                    
    AVG_ROW_LEN               NUMBER       Y                The average row length, including row overhead                                             
    AVG_SPACE_FREELIST_BLOCKS NUMBER       Y                The average freespace of all blocks on a freelist                                          
    NUM_FREELIST_BLOCKS       NUMBER       Y                The number of blocks on the freelist                                                       
    DEGREE                    VARCHAR2(10) Y                The number of threads per instance for scanning the table                                  
    INSTANCES                 VARCHAR2(10) Y                The number of instances across which the table is to be scanned                            
    CACHE                     VARCHAR2(5)  Y                Whether the table is to be cached in the buffer cache                                      
    TABLE_LOCK                VARCHAR2(8)  Y                Whether table locking is enabled or disabled                                               
    SAMPLE_SIZE               NUMBER       Y                The sample size used in analyzing this table                                               
    LAST_ANALYZED             DATE         Y                The date of the most recent time this table was analyzed                                   
    PARTITIONED               VARCHAR2(3)  Y                Is this table partitioned? YES or NO                                                       
    IOT_TYPE                  VARCHAR2(12) Y                If index-only table, then IOT_TYPE is IOT or IOT_OVERFLOW or IOT_MAPPING else NULL         
    TEMPORARY                 VARCHAR2(1)  Y                Can the current session only see data that it place in this object itself?                 
    SECONDARY                 VARCHAR2(1)  Y                Is this table object created as part of icreate for domain indexes?                        
    NESTED                    VARCHAR2(3)  Y                Is the table a nested table?                                                               
    BUFFER_POOL               VARCHAR2(7)  Y                The default buffer pool to be used for table blocks                                        
    ROW_MOVEMENT              VARCHAR2(8)  Y                Whether partitioned row movement is enabled or disabled                                    
    GLOBAL_STATS              VARCHAR2(3)  Y                Are the statistics calculated without merging underlying partitions?                       
    USER_STATS                VARCHAR2(3)  Y                Were the statistics entered directly by the user?                                          
    DURATION                  VARCHAR2(15) Y                If temporary table, then duration is sys$session or sys$transaction else NULL              
    SKIP_CORRUPT              VARCHAR2(8)  Y                Whether skip corrupt blocks is enabled or disabled                                         
    MONITORING                VARCHAR2(3)  Y                Should we keep track of the amount of modification?                                        
    CLUSTER_OWNER             VARCHAR2(30) Y                Owner of the cluster, if any, to which the table belongs                                   
    DEPENDENCIES              VARCHAR2(8)  Y                Should we keep track of row level dependencies?                                            
    COMPRESSION               VARCHAR2(8)  Y                Whether table compression is enabled or not                                                
    DROPPED                   VARCHAR2(3)  Y                Whether table is dropped and is in Recycle Bin                                             
     
    SQL> select table_name,tablespace_name from user_tables;

     
    TABLE_NAME                     TABLESPACE_NAME
    ------------------------------ ------------------------------
    SALGRADE                       USERS
    BONUS                          USERS
    EMP                            USERS
    DEPT                           USERS

    例子中主要適用EMP,DEPT倆個表

    準備結束。下一節開始圍繞該表介紹我的orcle SQL菜鳥筆記

    posted on 2008-03-28 09:26 如果有一天de 閱讀(566) 評論(0)  編輯  收藏 所屬分類: 我的Oracle菜鳥筆記

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 免费无码av片在线观看| 亚洲国产精品无码第一区二区三区| 免费在线观看自拍性爱视频| 成人免费视频88| 亚洲AV一区二区三区四区| 四虎在线免费播放| 狠狠入ady亚洲精品| 四虎在线播放免费永久视频 | 美女在线视频观看影院免费天天看| 亚洲精品无码久久久| 成年免费大片黄在线观看com| 亚洲男人天堂2020| 久操视频免费观看| 亚洲制服丝袜一区二区三区| 成人免费AA片在线观看| 亚洲av日韩综合一区久热| 亚洲国产精品成人| 久久精品免费一区二区三区| 亚洲国产视频网站| 国产精品99久久免费| 免费看黄的成人APP| 亚洲成人福利网站| 国产大片51精品免费观看| 中文字幕久无码免费久久| 亚洲综合久久1区2区3区| 大学生a级毛片免费观看| 免费看一级高潮毛片| 亚洲av日韩av天堂影片精品| 国产精品成人免费福利| 国产精品亚洲专一区二区三区| 亚洲中文字幕不卡无码| 91网站免费观看| 人碰人碰人成人免费视频| 久久久久亚洲精品日久生情 | 一本一道dvd在线观看免费视频| 国产精品亚洲成在人线| 国产精品成人观看视频免费| 四虎国产精品成人免费久久 | 免费的黄色的网站| 亚洲日本香蕉视频| 亚洲国产高清在线一区二区三区|