oracle 新建数据库

Posted on 2013-04-15 14:56  JasmineLiu  阅读(259)  评论(0编辑  收藏  举报
启动服务后

C:\Users\Jasmine>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 19 09:26:31 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

SQL> conn / as sysdba
Connected.

如果没有其服务,还要启动服务:

SQL> startu确定是以管理员身份登录的,然后执行以下操作:

1.首先,创建(新)用户:
create user username identified by password;
username:新用户名的用户名
password: 新用户的密码
也可以不创建新用户,而仍然用以前的用户,如:继续利用scott用户

2.创建表空间:
create tablespace tablespacename datafile 'd:\data.dbf' size xxxm;
tablespacename:表空间的名字
d:\data.dbf':表空间的存储位置
xxx表空间的大小,m单位为兆(M)
3.将空间分配给用户:
alert user username default tablespace tablespacename;
将名字为tablespacename的表空间分配给username

4.给用户授权:
grant create session,create table,unlimited tablespace to username;

5.然后再以楼主自己创建的用户登录,登录之后创建表即可。
conn username/password;



其他特殊查询:

   查询sid      select instance_name from V$instance;

     查询用户名     select username from dba_users;

 

oracle启动服务命令

C:\Users\Jasmine>net start oracleserviceorcl
服务正在启动或停止中,请稍候片刻后再试一次。


C:\Users\Jasmine>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 19 09:26:31 2013

Copyright (c) 1982, 2010, Oracle. All rights reserved.

SQL> conn / as sysdba
Connected.


SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first

现在可以正常试用

SQL> create table test(new varchar2(25));

 

 

oracle启动监听命令

C:\Users\Jasmine>lsnrctl start

查看状态用 lsnrctl status

关闭用      lsnrctl stop

 

Copyright © 2024 JasmineLiu
Powered by .NET 8.0 on Kubernetes