数据库启动,运行窗口或命令行下输入:
net start OracleXETNSListener
net start OracleServiceXE
1、连接数据库
运行窗口输入:sqlplus
输入用户名:system
输入密码:123456
如果一次性登陆:sqlplus system/123456@stshr
sqlplus cdxt_hospital/123456
解释:sqlplus system(用户名)/123456(密码)@stshr(数据库名)
2、创建表空间
create tablespace cdxthis datafile
'D:\oraclexe\oradata\XE\cdxthis.dbf' size 200m autoextend on next
10m maxsize unlimited;
create temporary tablespace cdxthis_temp tempfile
'D:\oraclexe\oradata\XE\cdxthis_temp.dbf' size 128m;
3、创建用户
create user cdxt_hospital identified by "123456" default tablespace
cdxthis temporary tablespace cdxthis_temp;
4、给用户授予权限
grant imp_full_database,connect,resource,dba to cdxt_hospital;
5、数据导入
【注意】此步骤不是在SQL Plus下完成,而是在运行窗口或控制台下键入。
imp cdxt_hospital/123456@orcl
file=D:\oraclexe\cdxthis20120702_2.dmp fromuser=cdxt_hospital touser=cdxt_hospital
tablespaces=users
如果是【Oracle Database 10g Express Edition】版本,修改为
imp cdxt_hospital/123456@xe
file=D:\oraclexe\cdxthis20120702_2.dmp fromuser=cdxt_hospital touser=cdxt_hospital
tablespaces=users
如果以后要删除用户的表,重新导入,则用system账户登录sqlplus,键入:
drop user cdxt_hospital cascade;
如何改变Oracle 10g Express Edition默认的8080端口
call
dbms_xdb.cfg_update(updateXML(dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text
()',9999));
级联删除用户下所有表:
drop user cdxt_hospital cascade;
create user cdxt_hospital identified by "123456";
grant imp_full_database,connect,resource,dba to cdxt_hospital;
查询约束:
SELECT constraint_name, table_name
FROM user_constraints
WHERE table_name = 'PEM_CUST_PERSONLEDGER' ;
删除约束:
alter table PEM_CUST_PERSONLEDGER drop constraint
REFPEM_CUST_GROUPLEDGER24 cascade;
查询表:
select custId,custNumber,groupId,address from PEM_CUST_PERSONLEDGER
;
清空表:
delete from
PEM_CUST_PERSONLEDGER ;
查看表结构:
desc PEM_CUST_PERSONLEDGER;
插入表数据:
insert into pem_cust_personLedger ( cardNumber,custId) values
('aaaaa','11')