Chinaunix首页 | 论坛 | 博客
  • 博客访问: 194567
  • 博文数量: 19
  • 博客积分: 1865
  • 博客等级: 上尉
  • 技术积分: 640
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-06 10:34
文章分类

全部博文(19)

文章存档

2012年(19)

我的朋友

分类: Oracle

2012-08-13 17:04:04

1.创建用户
  1. CREATE USER "pin62" IDENTIFIED BY pin62
  2.       DEFAULT TABLESPACE "PIN00"
  3.       TEMPORARY TABLESPACE "TEMP"
  4.    
  5. SQL> grant connect,resource to pin62;
    grant connect,resource to pin62
                              *
    ERROR at line 1:
    ORA-01917: user or role 'PIN62' does not exist
    SQL> select USERNAME||','||USER_ID||','||ACCOUNT_STATUS from dba_users;
    OUTLN,11,OPEN
    MGMT_VIEW,30,OPEN
    SYS,0,OPEN
    SYSTEM,5,OPEN
    SYSMAN,28,OPEN
    pin62,31,OPEN
    DBSNMP,24,EXPIRED & LOCKED
    WMSYS,26,EXPIRED & LOCKED
    TSMSYS,21,EXPIRED & LOCKED
    DIP,19,EXPIRED & LOCKED
    ORACLE_OCM,25,EXPIRED & LOCKED
    SQL> grant connect,resource to "pin62";
    Grant succeeded.
    SQL> conn pin62/pin62
    ERROR:
    ORA-01017: invalid username/password; logon denied

    Warning: You are no longer connected to ORACLE.
    SQL> conn "pin62"/pin62
    Error accessing PRODUCT_USER_PROFILE
    Warning:  Product user profile information not loaded!
    You may need to run PUPBLD.SQL as SYSTEM
    Connected.
    SQL>
准确的创建用户的方法

  1. CREATE USER pin62 IDENTIFIED BY pin62
  2.       DEFAULT TABLESPACE "PIN00"
  3.       TEMPORARY TABLESPACE "TEMP"
  4. SQL>    CREATE USER pin62 IDENTIFIED BY pin62
      2        DEFAULT TABLESPACE "PIN00"
      3        TEMPORARY TABLESPACE "TEMP";
  5. User created.
  6. SQL> grant connect,resource to pin62;
  7. Grant succeeded.
2.关于Oracle的用户名和密码的大小写
1:Oracle的用户名,默认创建到中会自动全部转换为大写保存
2:Oracle的账号密码不区分大小写
 
以下是验证过程:
1:验证密码不区分大小。无论密码是否加双引号
修改用户密码,不加引号
SQL> alter user harvey identified by fih123456;
User altered.
SQL> disconn
Disconnected from Oracle Database Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
以原密码连接
SQL> conn harvey/fih123456;
Connected.
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
 
以大写密码连接
SQL> conn harvey/FIH123456;
Connected.
再次修改密码,使用双引号
SQL> alter user harvey identified by "fih123456";
User altered.
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn harvey/FIH123456;
Connected.
自此发现也是成功的,所以Oracle的账号密码不区分大小写。
 
2:验证用户名的大小写
SQL> create user testa identified by abc123 default tablespace testa temporary tablespace temp;
User created.
SQL> grant connect,resource to testa;
Grant succeeded.
 
SQL> create user "testb" identified by abc123 default tablespace testb temporary tablespace temp;
User created.
SQL> grant connect,resource to testb;
grant connect,resource to testb
                          *
ERROR at line 1:
ORA-01917: user or role 'TESTB' does not exist

SQL> grant connect,resource to "testb";
Grant succeeded.
 
SQL> select username from dba_users
  2  where account_status='OPEN';
USERNAME
------------------------------
MGMT_VIEW
SYS
SYSTEM
DBSNMP
SYSMAN
HARVEY
TESTA
testb
8 rows selected.
 
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn testa/abc123
Connected.
SQL> disconn
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> conn testb/abc123
ERROR:
ORA-01017: invalid username/password; logon denied

SQL> conn "testb"/abc123;
Connected.
至此,推测oracle默认把用户名转成大写存入数据库中,双引号原样保留。
3.删除用户

  1. SQL> select username from dba_users where account_status='OPEN';

  2. USERNAME
  3. ------------------------------

  4. SYSTEM
  5. SYS
  6. SYSMAN
  7. MGMT_VIEW
  8. pin62
  9. OUTLN

  10. 6 rows selected.

  11. SQL> drop user "pin62" cascade;

  12. User dropped.

  13. SQL> select username from dba_users;
  14. USERNAME
    ------------------------------
    OUTLN
    MGMT_VIEW
    SYS
    SYSTEM
    SYSMAN
    PIN62
    DBSNMP
    WMSYS
    TSMSYS
    DIP
    ORACLE_OCM

  15. SQL> conn pin62/pin62
    Error accessing PRODUCT_USER_PROFILE
    Warning:  Product user profile information not loaded!
    You may need to run PUPBLD.SQL as SYSTEM
    Connected.

阅读(1121) | 评论(0) | 转发(0) |
0

上一篇:ORACLE 参数查询

下一篇:ORACLE 权限-DBA

给主人留下些什么吧!~~