今天安装了一下oracle11g 遇到了一些问题,和解决方案,
一、安装时提示windows 没有安装NET 3.0******,安装失败后,跳过安装,后面没有影响
二、安装完成后系统默认的数据库实例是orcl,如果不需要的话,可以不用自己重新建实例
三、 用数据库工具连接数据库时报:连接不上服务
tnsnames.ora
路:D:appAdministratorproduct11.2.0dbhome_1NETWORKADMIN nsnames.ora
# tnsnames.ora Network Configuration File: D:appAdministratorproduct11.2.0dbhome_1NETWORKADMIN nsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 自己的ip)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 自己的ip)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
listener.ora
D:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora
# listener.ora Network Configuration File: D:appAdministratorproduct11.2.0dbhome_1NETWORKADMINlistener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:appAdministratorproduct11.2.0dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:appAdministratorproduct11.2.0dbhome_1inoraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:appAdministratorproduct11.2.0dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 自己的ip)(PORT = 1521))
)
ADR_BASE_LISTENER = D:appAdministrator
其中报错后添加的
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:appAdministratorproduct11.2.0dbhome_1)
(SID_NAME = ORCL)
然后重新启动监听服务
我的电脑-》右键-》-》属性-》服务和应用程序-》服务-》
其中oracle***TNSListener 和oracleServiceORCL 需要重启
用数据库工具连接成功后,建表空间,用户
此过程我使用system用户创建的,因为是新建的oracle,登陆的密码是安装时时设置的,尽量使用数据库连接工具,不要用自带的sqlplus ,因为我试过发现,这两个建的数据是隔离的,相互查不到,不知道哪里设置不对
创建表空间
CREATE TABLESPACE NNC_DATA01 DATAFILE 'D:ORACLEORADATAORA11G
nc_data01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1m ;
CREATE TABLESPACE NNC_INDEX01 DATAFILE 'D:ORACLEORADATAORA11G
nc_index01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K ;
CREATE TABLESPACE TEMPFILE DATAFILE 'D:ORACLEORADATAORA11G emp01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K ;
创建用户
CREATE USER NCC001 IDENTIFIED BY 1 DEFAULT TABLESPACE NNC_DATA01 TEMPORARY TABLESPACE temp;
分配角色权限
GRANT connect,dba to NCC001;
ALTER DATABASE TEMPFILE 'D:ORACLEORADATAORA11G emp01.dbf' AUTOEXTEND ON NEXT 256M MAXSIZE 10240M;
select * from sm_super_user
如果失败,重新创建,删除对应建的空间和用户
--删除用户
DROP USER NCCTEST CASCADE;
--删除表空间。
DROP TABLESPACE NNC_DATA01 INCLUDING CONTENTS AND DATAFILES;
DROP TABLESPACE NNC_INDEX01 INCLUDING CONTENTS AND DATAFILES;
--删除空的表空间,不包含物理文件。
DROP TABLESPACE tablespace_name;
--删除空表空间,包含物理文件。
DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
--删除非空表空间,不包含物理文件。
DROP TABLESPACE tablespace_name INCLUDING DATAFILES;
--删除非空表空间,包含物理文件。
DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES;