1、sqlplus / as sysdba 链接数据库
2、create user zzg identified by zzg123; 创建用户
3、create tablespace ts_zzg datafile 'f:\ts_zzg\zzg_data.dbf' size 200M; 创建表空间
4、alter user zzg default tablespace ts_zzg; 分配给用户
5、grant create session,create table,create view,create sequence,unlimited tablespace to zzg; 授权
6、conn ; 登陆;完成
补充:
-- 登录
sqlplus system/oracle@//localhost:1521/orcl
-- 登录修改密码等
sqlplus /nolog
connect sys/oracle as sysdba;
alter user sys identified by newpassword;
alter user system identified by newpassword;
-- 创建用户和授权
create user xxx identified by password;
grant create session to xxx;
grant create table,unlimited tablespace to xxx;
grant select any table to xxx;
GRANT UPDATE ANY TABLE,DROP ANY TABLE,INSERT ANY TABLE TO xxx;
alter system set O7_DICTIONARY_ACCESSIBILITY=true scope=spfile;
-- 删除用户
drop user xxx cascade;
-- 查看实例
select instance_name from v$instance;
-- 查看表空间
select TABLESPACE_NAME, FILE_NAME from dba_data_files;
-- 创建表空间
create tablespace user_data logging datafile '/u01/app/oracle/oradata/xe/user_data01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 查看临时表空间
select TABLESPACE_NAME, FILE_NAME from dba_temp_files;
-- 创建临时表空间
create temporary tablespace user_temp tempfile '/u01/app/oracle/oradata/xe/user_temp01.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
-- 创建用户
create user username identified by password default tablespace user_data temporary tablespace user_temp;
-- 给用户授予权限
grant connect,resource,dba to username;