Oracle如何创建数据库
C:\Users\爸爸>sqlplus --执行OracleSQL*Plus: Release 11.2.0.1.0 Production on 星期四 3月 10 14:14:05 2022Copyright (c) 1982, 2010, Oracle. All rights reserved.请输入用户名: system --用户名输入口令: --密码连接到:Oracle Databa
C:\Users\爸爸>sqlplus --执行Oracle
SQL*Plus: Release 11.2.0.1.0 Production on 星期四 3月 10 14:14:05 2022
Copyright (c) 1982, 2010, Oracle. All rights reserved.
请输入用户名: system --用户名
输入口令: --密码
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create tablespace animal --创建一个表空间
2 datafile'D:\student.dbf' --指定文件路径
3 size 10M --大小
4 autoextend on; --自动增长
表空间已创建。
SQL> select tablespace_name from user_tablespaces; --查看所有的表空间
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
EXAMPLE
ANIMAL
已选择7行。
SQL> create table student --创建表
2 (
3 name varchar(12),
4 age varchar(12)
5 )
6 tablespace animal; --放到animal表空间中
表已创建。
SQL> select tablespace_name,table_name from user_tables where tablespace_name='ANIMAL'; --查询ANIMAL表空间中所有的表(注意必须为大写,Oracle创建默认变为大写)
TABLESPACE_NAME TABLE_NAME
------------------------------ ------------------------------
ANIMAL STUDENT
SQL> create user zzp identified by zzp --创建一个用户
2 default tablespace ANIMAL; --指定表空间
用户已创建。
SQL> grant connect,resource,dba to zzp; --给用户DBA权限
授权成功。
SQL> conn zzp/zzp --切换角色
已连接。
SQL> insert into system.student values('小明','18'); --向student表添加一条数据
已创建 1 行。
SQL> select * from system.student ; --查询student表中的全部数据
NAME AGE
------------ ------------
小明 18
SQL>
更多推荐
所有评论(0)