查询所有表空间
select * from dba_tablespaces;
查询所有用户
select * from dba_users;
sysdba方式登录
sqlplus /nolog-->conn /as sysdba;
解决用户被锁定
alter user username account unlock;
参考:
修改用户密码
alter user username identified by password;
新增用户并分配表空间
参考1、创建表空间
create tablespace user_data datafile 'D:\ a.dbf' size 50m autoextend on next 50m
[ maxsize 20480m extent management local ];
2、创建用户
create user username identified by password default tablespace user_data;
3、授权
grant connect,resource,dba to username;
oracle11g安装参考
用客户端 pl/sql 连接登录的时候,提示 "ORA-12514: TNS: no listener"。
在服务器用 telnet localhost 1521 和 telnet 127.0.0.1 1521 都可以,但是 telnet IP 1251 不行。
解决方案:
将服务端的 \product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora 的
(ADDRESS = (PROTOCOL = TCP)(HOST =127.0.0.1)(PORT = 1521))
改为:
(ADDRESS = (PROTOCOL = TCP)(HOST =计算机名)(PORT = 1521))
然后重启 11gClientListener 服务
一、oracle备份和还原
数据库ORCL全部导出:
exp username/password :1521/ORCL file=d:\test.dmp [full=y]
导出test和sys用户的表:
exp username/password :1521/ORCL file=d:\test.dmp owner=(test,sys)
导出某几个表
exp username/password :1521/ORCL file=d:\test.dmp tables=(table1,table2)
将备份导入ORCL数据库
若数据结构不存在(表)
imp username/password :1521/ORCL file=d:\test.dmp [fromuser=user1 touser=user2]
若数据结构已存在(表)
imp username/password :1521/ORCL file=d:\test.dmp [fromuser=user1 touser=user2] ignore=y
参考:
navicat中使用数据泵进行数据备份和还原,参考
连接Oracle 报错ORA-12514: TNS:listener does not currently know of service requested in connec解决办法
可通过修改listener.ora文件解决。
安装目录E:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN 下加上一段代码(蓝色部分):
SID_LIST_LISTENER =
(SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:E:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") )(SID_DESC = (GLOBAL_DBNAME = ORCL) (ORACLE_HOME = E:\app\Administrator\product\11.2.0\dbhome_1) (SID_NAME = ORCL) ) )关掉Service和LISTENER,再启动Service和LISTENER,即可解决。