oracle安装后测试
LSNRCTL STATU 查看监听器
启动和测试oracle是否安装成功
测试步骤1:请执行操作系统级的命令:tnsping orcl
测试步骤 2:请执行操作系统级的命令:sqlplus system/password@orcl
安装完oracle后要启动oracle服务,后监听
1 su - oracle
2 sqlplus /nolog
3 sql> conn / as sysdba
4 sql> startup (一般不需要加参数,只要设置好环境变量)启动oracle服务
5 sql> quit (退出sql模式)
6 lsnrctl start (启动监听器)
7 lsnrctl stop(关闭监听器,在这之前,应该先关闭应用程序)
8 sqlplus /nolog
要测试数据安装是否成功,可按顺序执行以下两个步骤:
测试步骤1:请执行操作系统级的命令:tnsping orcl
上述命令假定全局数据库名是 orcl。以下是命令执行后的示例:
C:\>tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 10-11月-2005 10:09:58
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的参数文件:
C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 TNSNAMES适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dbserver
)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK(50毫秒)
其中,结果OK 至关重要。上述结果如果正确,表明侦听器配置无误。
如果没有看到此结果,不要继续进行下一步。请检查:
使用 Oracle Net Configuration Assistant检查网络配置(netca命令)
使用 Database Configuration Assistant检查数据库配置(dbca命令)
测试步骤 2:请执行操作系统级的命令:sqlplus system/password@orcl
上述命令假定 SYSTEM用户对应的口令是 password,假定全局数据库名是 orcl。
以下是命令执行后的示例(请手工输入红色部分文字):
C:\>sqlplus system/password@orcl
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 11月 10 10:15:25 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Release 10.2.0.1.0 - Production
SQL>SELECT 1+2+3+4 测试结果 FROM DUAL;
测试结果
----------
10
上述结果如果正确,表明数据库例程安装和启动正常。
解锁scott用户
程序|运行,输入cmd打开
输入sqlplus/nolog
依次按顺序输入:
SQL>conn/as sysdba
SQL>alter user scott account unlock;
SQL>disconnect
SQL>conn scott/tiger@创建的数据库名(即:database);
重设密码
权限分为系统权限和对象权限。
授予连接权限:
grant connect to scott;
授予创建表等基本权限:
grant resource to scott;
授予dba:
grant dba to scott;
授予使用空间权限:
grant unlimited on tablespace to scott;
alter user scott quota unlimited on tablespace_name;
备注:
用户解锁和修改密码
alter user scott identified by password account unlock;
/*第1步:创建临时表空间 */
create temporary tablespace user_temp
tempfile 'D:\app\tablespace\user_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
/*第2步:创建数据表空间 */
create tablespace user_data
logging
datafile 'D:\app\tablespace\user_data.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
/*创建指定表空间 FRAMEWORK */
create tablespace FRAMEWORK
logging
datafile 'D:\app\tablespace\FRAMEWORK'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;
/*第3步:创建用户并指定表空间 */
create user username identified by password
default tablespace user_data
temporary tablespace user_temp;
/*第4步:给用户授予权限 */
grant connect,resource,dba to username;