【笔记】第1、2讲:sql概述

简要笔记:

查看当前用户:
SQL> show user
USER is "SYS"

查看dba_users数据字典:
SQL> desc dba_users
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 USERNAME                                  NOT NULL VARCHAR2(30)
 USER_ID                                   NOT NULL NUMBER
 PASSWORD                                           VARCHAR2(30)
 ACCOUNT_STATUS                            NOT NULL VARCHAR2(32)
 LOCK_DATE                                          DATE
 EXPIRY_DATE                                        DATE
 DEFAULT_TABLESPACE                        NOT NULL VARCHAR2(30)
 TEMPORARY_TABLESPACE                      NOT NULL VARCHAR2(30)
 CREATED                                   NOT NULL DATE
 PROFILE                                   NOT NULL VARCHAR2(30)
 INITIAL_RSRC_CONSUMER_GROUP                        VARCHAR2(30)
 EXTERNAL_NAME                                      VARCHAR2(4000)
 PASSWORD_VERSIONS                                  VARCHAR2(8)
 EDITIONS_ENABLED                                   VARCHAR2(1)
 AUTHENTICATION_TYPE                                VARCHAR2(8)

SQL> set lines 200


查看用户名和状态:
SQL> select username,account_status from  dba_users;  
USERNAME                                                     ACCOUNT_STATUS
------------------------------------------------------------ ----------------------------------------------------------------
SYS                                                          OPEN
SYSTEM                                                       OPEN
SCOTT                                                        OPEN
OUTLN                                                        EXPIRED & LOCKED
MGMT_VIEW                                                    EXPIRED & LOCKED
FLOWS_FILES                                                  EXPIRED & LOCKED
MDSYS                                                        EXPIRED & LOCKED
ORDSYS                                                       EXPIRED & LOCKED
EXFSYS                                                       EXPIRED & LOCKED
DBSNMP                                                       EXPIRED & LOCKED
WMSYS                                                        EXPIRED & LOCKED

USERNAME                                                     ACCOUNT_STATUS
------------------------------------------------------------ ----------------------------------------------------------------
HR                                                           EXPIRED & LOCKED
SPATIAL_CSW_ADMIN_USR                                        EXPIRED & LOCKED
SPATIAL_WFS_ADMIN_USR                                        EXPIRED & LOCKED

36 rows selected.

帮助文档查看:
sql---13 SQL Statements: ALTER TRIGGER to COMMIT---ALTER USER



状态从EXPIRED & LOCKED改成open:
SQL> alter user hr account unlock;
SQL>alter user hr identified by hr;


验证
SQL> conn hr/hr
Connected.
SQL> show user;
USER is "HR"

在数据字典user_tables中查看所有的表:
SQL> select  TABLE_NAME  from user_tables;

TABLE_NAME
------------------------------------------------------------
JOBS
EMPLOYEES
COUNTRIES
LOCATIONS
DEPARTMENTS
JOB_HISTORY
REGIONS

7 rows selected.

本文出自 “帝心禅影” 博客,请务必保留此出处http://yedee.blog.51cto.com/513852/1561316

【笔记】第1、2讲:sql概述

上一篇:过滤字符串的Html标记 c#函数 .


下一篇:hibernate的几种纯sql的查询方式