oracle数据库软件和实例安装好以后的配置

前端之家收集整理的这篇文章主要介绍了oracle数据库软件和实例安装好以后的配置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
=======
tnsnames.ora:
# tnsnames.ora Network Configuration File: H:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
#*****
ORCL1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 60.*****)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.sunny.com)
    )
  )
#*****
ORCL2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.*****)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  ) 
#*****
ORCL3=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.*****)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.sunny)
    )
  )



========
listener.ora:
# listener.ora Network Configuration File: H:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = H:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:H:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 60.*****)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.*****)(PORT = 1521))
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.*****)(PORT = 1521))
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = H:\app\Administrator

===================================================
//2015-03-27熟悉oracle数据库的基本知识,熟悉plsql操作:
//查询当前数据库名:
select name from v$database;               //结果:ORCL
//查询当前数据库实例名:(SID)
//实例名指的是用于响应某个数据库操作的数据库管理系统的名称。它同时也叫SID。
//数据库实例名(instance_name)用于对外部连接。在操作系统中要取得与数据库的联系,必须使用数据库实例名。
//比如我们作开发,要连接数据库,就得连接数据库实例名:
//jdbc:oracle:thin:@localhost:1521:orcl(orcl就为数据库实例名)
//一个数据库可以有多个实例,在作数据库服务集群的时候可以用到。

select instance_name from v$instance;     //结果:orcl,数据库实例名用于对外部连接,要连接数据库,就得连接数据库实例名。
===========================================================================================================
//scott用户访问表emp;
select * from emp;

//dept表
select * from dept;

//salgrade表
select * from salgrade;
===========================================================================================================
//创建完数据库后,并不能立即在数据库中建表,必须先创建该数据库用户,并且为该用户指定表空间。
//安徽工情
//1.创建表空间"ahdemo"
select instance_name from v$instance;
  create tablespace ahdemo datafile 'H:\app\Administrator\oradata\orcl\ahdemo.dbf' size 500m autoextend on next 100m maxsize 2048m; //表空间最大2g
//查看已经创建好的表空间
select default_tablespace,temporary_tablespace,d.username from dba_users d  where d.username like '%ah%'
 group by d.default_tablespace,d.temporary_tablespace,d.username.
 //查看所有表空间大小
 select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

//2.创建用户"ahuser",并为之分配创建的表空间和临时表空间,并为之授权
create user ahuser identified by "Sunny_123456]" default tablespace ahdemo temporary tablespace temp;
//有了用户,要想使用用户账号管理自己的表空间,还得给它分权限:(ahuser已被授予了connect/resource/dba三种权限)
grant connect to ahuser; 
grant resource to ahuser;
grant dba to ahuser;
//查看数据库用户
select * from dba_users order by created desc;
//=====================================================================================
//操作表
//==========================tb_users===
select *  from tb_users;

//==========================tb_dept===
select *  from tb_dept;
原文链接:https://www.f2er.com/oracle/209685.html

猜你在找的Oracle相关文章