前提是安装好oracle10g,并启动oracle
以sysdba进入
$ORACLE_HOME/bin/isqlplus "/as sysdba"
第一步:创建表空间(要建两个临时表空间和数据表空间)
创建临时表空间:
create temporary tablespace test_temp
tempfile '/app/oracle/oracle/product/10.2.0/oradata/test/test_temp01.dbf'
size 32m
autoextend on
next 32m maxsize 1024m
extent management local;
创建数据表空间:
create temporary tablespace test_data
tempfile '/app/oracle/oracle/product/10.2.0/oradata/test/test_data01.dbf'
size 32m
autoextend on
next 32m maxsize 1024m
extent management local;
注意:首先在确保"/app/oracle/oracle/product/10.2.0/oradata/test/"目录已存在,否则会报文件夹不存在的错
第二步:创建用户
create user test identified by testpassword
default tablespace test_data
temporary tablespace test_temp;
其中test为用户名,testpassword为密码
最后:给用户授予权限
grant connect,resource to test;
到用户和表空间都建完了,可以用该用户登陆了
$ORACLE_HOME/bin/sqlplus
Enter user-name: test
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from user_tables;
no rows selected
到了这一步我们就可以建表了,
建表就和其它数据库没有什么区别了,普通sql
如:
create table test_user(
first_name varchar2(15),
last_name varchar2(20)
);
删除用户:test
drop user test cascade
删除表空间:
DROP TABLESPACE data01 INCLUDING CONTENTS AND DATAFILES
删除表:
delete from users;
oracle 10g 创建和删出表空间,用户,表
最新推荐文章于 2021-11-03 22:32:11 发布