oracle监听器和创建用户、分配相应的权限

问题一:如果oracle监听器启动不了:
把listener.ora和tnsnames.ora的ip改为127.0.0.1


问题二:监听程序当前无法识别连接描述符中请求的服务


1、在计算机 开始—>管理–>服务中没有看到 OracleOraHome92TNSListener 服务,但服务已经启动2、C:\>lsnrctl start 执行完后报open service error。然后在计算机 开始—>管理–>服务中看到  了 OracleOraHome92TNSListener 服务
3、运行regedit.exe启动注册表编辑器,在HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/下的 Services和CurrentControlSet/Services下找到OracleOraHome92TNSListener项,在右边窗口按右键,新建/字符串,取名ImagePath。
双击新见的建,在“数值数据”项输入D:\oracle\ora92\bin\TNSLSNR.EXE(根据你自己的实际情况进行修改),确定完成。
再次在服务中双击打开OracleOraHome92TNSListener的服务看到其“可执行文件的路径”一栏已经显示了其正确的值。这时你可以启动监听了。4、C:>tnsping 数据库SID。看看tns服务没有起来。如果没有起来,用下面的命令
c:\>lsnrctl
lsnrctl>start把这个服务起动起来。c:\>lsnrctl start 后open service error错误消失,但例程中有一个状态为UNKNOWN,另一个为READY.命令执行成功。PL/SQL Developer连接Oracle报错:ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务

解决办法:

   首先重启下对应的数据库监听服务(OracleOraDb10g_home1TNSListener)和数据库服务 (OracleServiceORCL),如果还没解决,就按下面的进行操作:

   1. 打开%Oracle安装目录%/network/admin/listener.ora文件(C:\oracle\product\10.2.0 \db_1\NETWORK\ADMIN\listener.ora)
   2. 添加:
(SID_DESC =

    (GLOBAL_DBNAME = ORCL)

    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1) 

    (SID_NAME = ORCL)

    )
   3. 最后文件改成
SID_LIST_LISTENER =

(SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)

      (PROGRAM = extproc)

    )

   (SID_DESC =

    (GLOBAL_DBNAME = ORCL)

    (ORACLE_HOME = C:\oracle\product\10.2.0\db_1) 

    (SID_NAME = ORCL)

    )
)

LISTENER =

(DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))

    )

)

---创建用户和表空间
---创建临时表空间

create temporary tablespace xhcard_temp
tempfile 'E:\oracle\product\10.2.0\oradata\orcl\xhcard_temp.dbf'
size 32m
autoextend on
next 32m maxsize 20480m
extent management local;

---创建表空间
CREATE TABLESPACE xhcard
LOGGING
DATAFILE 'E:\oracle\product\10.2.0\oradata\orcl\xhcard.DBF'
SIZE 32M
AUTOEXTEND ON
NEXT 32M MAXSIZE 20480M
EXTENT MANAGEMENT LOCAL;

---创建用户
create user xhcard identified by xhcard
default tablespace xhcard
temporary tablespace xhcard_temp ;
--- 赋给用户权限
GRANT CREATE DATABASE LINK TO    "xhcard";
GRANT CREATE INDEXTYPE TO        "xhcard";
GRANT CREATE JOB TO              "xhcard";
GRANT CREATE PROCEDURE TO        "xhcard";
GRANT CREATE SEQUENCE TO         "xhcard";
GRANT CREATE SYNONYM TO          "xhcard";
GRANT CREATE TABLE TO            "xhcard";
GRANT CREATE TRIGGER TO          "xhcard";
GRANT CREATE VIEW TO             "xhcard";
GRANT DELETE ANY TABLE TO        "xhcard";
GRANT EXECUTE ANY PROCEDURE TO   "xhcard";
GRANT INSERT ANY TABLE TO        "xhcard";
GRANT SELECT ANY DICTIONARY TO   "xhcard";
GRANT SELECT ANY TABLE TO        "xhcard";
GRANT UPDATE ANY TABLE TO        "xhcard";
GRANT "CONNECT" TO               "xhcard";
GRANT "DBA" TO                   "xhcard";
GRANT "RESOURCE" TO              "xhcard";
---解除用户权限
REVOKE UNLIMITED TABLESPACE FROM "PROCESS5LINK_PROXY";
ALTER USER "PROCESS5LINK_PROXY" QUOTA UNLIMITED ON "PROCESS_DATA";
REM ALTER USER "PROCESS5LINK_PROXY" QUOTA UNLIMITED ON "PROCESS_INDEX";
ALTER USER "PROCESS5LINK_PROXY" GRANT CONNECT THROUGH "PROCESS5LINK_PROXY";

---删除表空间
drop tablespace xhcard
including contents and datafiles;

---压缩表空间
alter database datafile 'F:\oracle\product\10.2.0\oradata\orcl\表空间数据文件' resize 100M

--删除用户
drop user PROCESS5LINK_3 cascade;

--创建表
create table kk(
       id int
);
创建数据库







你可能感兴趣的:(oracle,sql,C++,c,C#)