oracle启动和连接问题

本机oracle测试库sys密码忘了,查了查解决方法,结果又碰到问题,又解决:

 

连接时候:connect /as sysdba

ERROR:

ORA-12560:TNS:协议适配器错误

解决方法:

1.services.msc服务中启动oracle9iTNSListener服务。

2.启动oracleServiceXXX,XXX为数据库SID

3.regedit修改HKEY_LOCAL_MACHINE/SOFTEWARE/ORACLE将环境变量oracle_sid设为XXX,XXX为数据库SID

 

继续sys密码修改:

oracle 提供两种验证方式,一种是OS验证,一种是密码文件验证方式,我采用第一种方式:

sqlplus /nolog

connect / as sysdba

alter user sys identified by XXX;               xxx新密码

alter user system identified by XXX;         xxx新密码

设定完后重启登录

 

显示当前数据库:

show parameter db_name

 

show parameter service

 

修改密码后登录:

sqlplus sys/xxx as sysdba

登录成功

sqlplus sys/xxx@orcl as sysdba报错:

TNS:连接超时

修改tnsnames.ora

ORCL =

  (DESCRIPTION =

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

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

    )

  )

sqlplus sys/xxx@orcl as sysdba报错:

 

ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = D:/oracle/product/10.2.0/db_1)

      (PROGRAM = extproc)

    )

    (SID_DESC =

    (GLOBAL_DBNAME = ORCL)

    (ORACLE_HOME = D:/oracle/product/10.2.0/db_1) 

    (SID_NAME = ORCL)

    )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

    )

    (DESCRIPTION =

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

    )

  )

 

以上粗体部件为增加的内容,修改后重启监听服务后即可。

 

 

创建用户:

create user username identified by pwd;
grant connect,resource,dba to username; 角色权限

 

 

你可能感兴趣的:(oracle,数据库,list,service,user)