Oracle11g用户管理
oracle rac11g 基本操作

oracle rac11g 基本操作摘要:1.Oracle RAC 11g 简介2.安装和配置Oracle RAC 11g3.Oracle RAC 11g 基本操作4.管理和监控Oracle RAC 11g5.优化Oracle RAC 11g 性能6.故障排除与维护正文:一、Oracle RAC 11g 简介Oracle RAC 11g(Real Application Clusters 11g)是Oracle 数据库的一个版本,它采用了分布式架构,可以将多个服务器连接在一起,形成一个共享存储的集群。
这种架构大大提高了数据库的性能、可伸缩性和容错能力。
本文将重点介绍Oracle RAC 11g 的一些基本操作。
二、安装和配置Oracle RAC 11g1.准备工作:确保服务器硬件和软件满足Oracle RAC 11g 的最低要求。
2.下载并安装Oracle 11g 软件:从Oracle 官方网站下载相应版本的软件,并根据提示进行安装。
3.配置Oracle RAC 环境:设置Grid Infrastructure 和Oracle Home,创建数据库实例。
4.配置网络和存储:设置存储网络,配置ASM(Automatic StorageManagement)和VIP(Virtual Interface Pool)。
三、Oracle RAC 11g 基本操作1.启动和关闭数据库:使用Oracle 命令启动和关闭数据库实例。
2.创建和管理表空间:使用SQL 语句创建表空间,配置存储参数。
3.创建和管理用户:使用SQL 语句创建用户,设置权限和角色。
4.备份与恢复:使用RMAN(Recovery Manager)进行数据库备份和恢复。
四、管理和监控Oracle RAC 11g1.使用Grid Control:Oracle 提供的一个集中式管理工具,用于监控和控制RAC 环境。
2.使用OEM(Oracle Enterprise Manager):一个集成化的管理平台,用于监控数据库性能、配置参数等。
Oracle数据库存储管理员指南11g Release 2 (11.2) E10500-01说明书

Oracle® Database Storage Administrator's Guide 11g Release 2 (11.2)E10500-01August 2009Oracle Database Storage Administrator's Guide, 11g Release 2 (11.2)E10500-01Copyright © 2007, 2009, Oracle and/or its affiliates. All rights reserved.Contributing Authors: Jerry Abraham, Prasad Bagal, Mark Bauer, Eric Belden, Bill Bridge, Chan Chan, Xiaobin Chen, Hanlin Chien, Jonathan Creighton, Steve Fogel, Dave Friedman, Barb Glover, Fred Glover, Shie-rei Huang, Diane Lebel, Rich Long, Colin McGregor, Gregory Mengel, Valarie Moore, Darshan Nagarajappa, Harish Nandyala, Bob Nelson, Satish Panchumarthy, Kathy Rich, Francisco Sanchez, Santhosh Selvaraj, Ara Shakian, Duane Smith, Joshua Smith, Malai Stalin, Amar Subba, Yaser Suleiman, Michael Timpanaro-Perrotta, Nitin Vengurlekar, Anton Verhulst, Radek Vingralek, Ron Weiss, Rajiv Wickremesinghe, Jim A. Williams, Sivakumar Yarlagadda, Song Ye, Krishnan Yegnashankaran, Hector Yuen This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.This software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.ContentsPreface (xxi)Audience (xxi)Documentation Accessibility (xxi)Related Documents (xxii)Conventions (xxii)What's New in Oracle Database Storage? (xxiii)New Storage Features for Oracle Database 11g Release 2 (11.2) (xxiii)New Storage Features for Oracle Database 11g Release 1 (11.1) (xxvi)1 Introduction to Oracle Automatic Storage ManagementOverview of Oracle Automatic Storage Management...................................................................... 1-1 Understanding Oracle ASM Concepts................................................................................................. 1-2 About Oracle ASM Instances........................................................................................................... 1-2 About Oracle ASM Disk Groups..................................................................................................... 1-6 About Mirroring and Failure Groups............................................................................................. 1-6 About Oracle ASM Disks.................................................................................................................. 1-7 Allocation Units ......................................................................................................................... 1-7 About Oracle ASM Files.................................................................................................................... 1-7 Extents.......................................................................................................................................... 1-8Oracle ASM Striping................................................................................................................... 1-9File Templates.............................................................................................................................. 1-9 Understanding Oracle ASM Disk Group Administration............................................................... 1-9 About Discovering Disks...............................................................................................................1-10 About Mounting Disk Groups......................................................................................................1-10 About Adding and Dropping Disks.............................................................................................1-10 About Online Storage Reconfigurations and Dynamic Rebalancing......................................1-10 2 Considerations for Oracle ASM StorageStorage Resources for Disk Groups...................................................................................................... 2-1 Oracle ASM and Multipathing.............................................................................................................. 2-3 Recommendations for Storage Preparation........................................................................................ 2-4iii3 Administering Oracle ASM InstancesOperating With Different Releases of Oracle ASM and Database Instances Simultaneously3-1 Configuring Initialization Parameters for an Oracle ASM Instance............................................. 3-2 Initialization Parameter Files for an Oracle ASM Instance.......................................................... 3-3 Backing Up, Copying, and Moving an Oracle ASM Initialization Parameter File................... 3-4 Setting Oracle ASM Initialization Parameters............................................................................... 3-5 Automatic Memory Management for Oracle ASM............................................................... 3-5 Oracle ASM Parameter Setting Recommendations....................................................................... 3-6 ASM_DISKGROUPS................................................................................................................... 3-7ASM_DISKSTRING.................................................................................................................... 3-7ASM_POWER_LIMIT................................................................................................................ 3-8ASM_PREFERRED_READ_FAILURE_GROUPS.................................................................. 3-8DB_CACHE_SIZE....................................................................................................................... 3-9DIAGNOSTIC_DEST.................................................................................................................. 3-9INSTANCE_TYPE....................................................................................................................... 3-9LARGE_POOL_SIZE...............................................................................................................3-10PROCESSES..............................................................................................................................3-10REMOTE_LOGIN_PASSWORDFILE...................................................................................3-10SHARED_POOL_SIZE............................................................................................................3-10 Setting Database Initialization Parameters for Use with Oracle ASM....................................3-11 Managing Oracle ASM Instances.......................................................................................................3-12 Administering Oracle ASM Instances with Server Control Utility.........................................3-12 Using Oracle Restart.......................................................................................................................3-12 Starting Up an Oracle ASM Instance............................................................................................3-13 About Mounting Disk Groups at Startup.............................................................................3-15About Restricted Mode...........................................................................................................3-15 Shutting Down an Oracle ASM Instance.....................................................................................3-16 Upgrading an Oracle ASM Instance With Oracle Universal Installer.....................................3-17 Downgrading an Oracle ASM Instance.......................................................................................3-19 Active Session History Sampling for Oracle ASM.....................................................................3-21 Using Oracle ASM Rolling Upgrade.................................................................................................3-21 Patching Oracle ASM Instances.........................................................................................................3-22 Authentication for Accessing Oracle ASM Instances....................................................................3-22 About Privileges for Oracle ASM.................................................................................................3-23 Using One Operating System Group for Oracle ASM Users............................................3-23Using Separate Operating System Groups for Oracle ASM Users...................................3-24The SYSASM Privilege for Administering Oracle ASM....................................................3-25The SYSDBA Privilege for Managing Oracle ASM Components.....................................3-26 Creating Users with the SYSASM Privilege................................................................................3-26 Operating System Authentication for Oracle ASM ...................................................................3-26 Password File Authentication for Oracle ASM ..........................................................................3-27 Migrating a Database to Use Oracle ASM........................................................................................3-27 Using Oracle Enterprise Manager to Migrate Databases to Oracle ASM...............................3-28 Using Oracle Recovery Manager to Migrate Databases to Oracle ASM.................................3-28 Best Practices White Papers on Migrating to Oracle ASM........................................................3-28 iv4 Administering Oracle ASM Disk GroupsDisk Group Attributes............................................................................................................................ 4-2 Creating Disk Groups............................................................................................................................. 4-3 Using the CREATE DISKGROUP SQL Statement........................................................................ 4-3 Example: Creating a Disk Group..................................................................................................... 4-5 Creating Disk Groups for a New Oracle Installation.................................................................... 4-6 Specifying the Allocation Unit Size................................................................................................. 4-7 Specifying the Sector Size for Drives............................................................................................... 4-8 Oracle Cluster Registry and Voting Files in Oracle ASM Disk Groups..................................4-10 Altering Disk Groups...........................................................................................................................4-11 Adding Disks to a Disk Group......................................................................................................4-12 Example: Adding Disks to a Disk Group.............................................................................4-12 Adding Volumes to Disk Groups.................................................................................................4-13 Dropping Disks from Disk Groups..............................................................................................4-14 Example: Dropping Disks from Disk Groups......................................................................4-15 Intelligent Data Placement.............................................................................................................4-15 Resizing Disks in Disk Groups......................................................................................................4-16 Example: Resizing Disks in Disk Groups.............................................................................4-16 Undropping Disks in Disk Groups...............................................................................................4-17 Example: Undropping Disks in Disk Groups......................................................................4-17 Manually Rebalancing Disk Groups............................................................................................4-17 Example: Manually Rebalancing a Disk Group..................................................................4-18 Tuning Rebalance Operations.......................................................................................................4-18 Oracle ASM Disk Discovery ..............................................................................................................4-18 How A Disk is Discovered.............................................................................................................4-19 Disk Discovery Rules......................................................................................................................4-20 Improving Disk Discovery Time...................................................................................................4-20 Managing Capacity in Disk Groups..................................................................................................4-21 Negative Values of USABLE_FILE_MB.......................................................................................4-23 Oracle ASM Mirroring and Disk Group Redundancy..................................................................4-23 Oracle ASM Mirroring and Failure Groups................................................................................4-23 Oracle ASM Failure Groups...................................................................................................4-24How Oracle ASM Manages Disk Failures............................................................................4-25Guidelines for Using Failure Groups....................................................................................4-25Failure Group Frequently Asked Questions........................................................................4-25 Oracle ASM Recovery from Read and Write I/O Errors..........................................................4-26 Oracle ASM Fast Mirror Resync...................................................................................................4-27 Preferred Read Failure Groups.....................................................................................................4-29 Configuring and Administering Preferred Read Failure Groups....................................4-29 Performance and Scalability Considerations for Disk Groups....................................................4-30 Determining the Number of Disk Groups...................................................................................4-31 Performance Characteristics When Grouping Disks.................................................................4-31 Oracle ASM Storage Limits...........................................................................................................4-31 Disk Group Compatibility..................................................................................................................4-31 Overview of Disk Group Compatibility......................................................................................4-32 Disk Group Compatibility Attributes..........................................................................................4-33 COMPATIBLE.ASM................................................................................................................4-33vCOMPATIBLE.RDBMS...........................................................................................................4-33COMPATIBLE.ADVM............................................................................................................4-33 Setting Disk Group Compatibility Attributes.............................................................................4-34 Valid Combinations of Compatibility Attribute Settings..................................................4-34Using CREATE DISKGROUP with Compatibility Attributes..........................................4-35Using ALTER DISKGROUP with Compatibility Attributes.............................................4-35Viewing Compatibility Attribute Settings...........................................................................4-36Features Enabled By Disk Group Compatibility Attribute Settings................................4-36Reverting Disk Group Compatibility....................................................................................4-37 Considerations When Setting Disk Group Compatibility in Replicated Environments......4-38 Managing Oracle ASM File Access Control for Disk Groups......................................................4-38 About Oracle ASM File Access Control.......................................................................................4-39 Using SQL Statements to Set Disk Group Attributes for Oracle ASM File Access Control.4-40 Using SQL Statements to Manage Oracle ASM File Access Control.......................................4-41 Mounting and Dismounting Disk Groups......................................................................................4-42 Mounting Disk Groups Using the FORCE Option.....................................................................4-43 Checking the Internal Consistency of Disk Group Metadata......................................................4-44 Dropping Disk Groups........................................................................................................................4-44 Renaming Disks Groups......................................................................................................................4-45 5Introduction to Oracle ACFSOverview of Oracle ACFS...................................................................................................................... 5-1 Understanding Oracle ACFS Concepts................................................................................................ 5-3 About Oracle ACFS............................................................................................................................ 5-4 About Oracle ACFS and Oracle Database Homes........................................................................ 5-4 About Oracle ASM Dynamic Volume Manager............................................................................ 5-5 About the Oracle ACFS Driver Model............................................................................................ 5-6 About the Oracle ACFS Mount Model and Namespace.............................................................. 5-6 About the Oracle ACFS Mount Registry........................................................................................ 5-6 About Oracle ACFS Snapshots......................................................................................................... 5-6 About Oracle ACFS and Backup and Restore................................................................................ 5-7 About Oracle ACFS Integration with Oracle ASM....................................................................... 5-7 Understanding Oracle ACFS Administration.................................................................................... 5-8 Oracle ACFS and File Access and Administration Security........................................................ 5-8 Oracle ACFS and Grid Infrastructure Installation........................................................................ 5-8 Oracle ACFS and Grid Infrastructure Configuration................................................................... 5-8 Clusterware Resources and Oracle ACFS Administration.......................................................... 5-9 Oracle ACFS and Dismount or Shutdown Operations.............................................................5-10 Overview of Oracle ASM Dynamic Volume Manager..................................................................5-10 6Using Views to Display InformationViews Containing Oracle ASM Disk Group Information............................................................... 6-1 Viewing Oracle ASM File Access Control Information................................................................ 6-4 Viewing Disk Region Information................................................................................................... 6-5 Views Containing Oracle ACFS Information..................................................................................... 6-6 vi7 Administering Oracle ASM Files, Directories, and TemplatesWhat Types of Files Does Oracle ASM Support?.............................................................................. 7-1 About Oracle ASM Filenames............................................................................................................... 7-2 Single File Creation Form................................................................................................................. 7-3 Multiple File Creation Form............................................................................................................. 7-4 Fully qualified File Name Form....................................................................................................... 7-4 Alias Oracle ASM Filename Forms................................................................................................. 7-5 Creating a Tablespace in Oracle ASM: Using a Data File with an Alias Name................. 7-6 Alias Oracle ASM Filename with Template Form........................................................................ 7-6 Incomplete Oracle ASM Filename Form........................................................................................ 7-7 Incomplete Oracle ASM Filename with Template Form.............................................................. 7-7 Creating and Referencing Oracle ASM Files in the Database........................................................ 7-7 Creating Oracle ASM Files Using a Default File Location for Disk Group Specification....... 7-8 Using Oracle ASM Filenames in SQL Statements......................................................................... 7-9 Managing Alias Names for Oracle ASM Filenames......................................................................... 7-9 Adding an Alias Name for an Oracle ASM Filename...............................................................7-10 Renaming an Alias Name for an Oracle ASM Filename...........................................................7-10 Dropping an Alias Name for an Oracle ASM Filename............................................................7-10 Dropping Files and Associated Aliases from a Disk Group.....................................................7-10 Managing Disk Group Directories....................................................................................................7-11 Creating a New Directory..............................................................................................................7-11 Renaming a Directory.....................................................................................................................7-12 Dropping a Directory.....................................................................................................................7-12 Accessing Oracle ASM Files with the XML DB Virtual Folder...................................................7-12 Inside /sys/asm..............................................................................................................................7-13 Using DBMS_FILE Transfer Utility for Oracle ASM.....................................................................7-14 Managing Disk Group Templates......................................................................................................7-15 Template Attributes........................................................................................................................7-15 Adding Templates to a Disk Group.............................................................................................7-17 Modifying a Disk Group Template..............................................................................................7-18 Dropping Templates from a Disk Group....................................................................................7-18 Creating Tablespaces in Oracle ASM: Specifying Attributes with Templates.......................7-18 8 Performing Oracle ASM Data Migration With RMANOverview of Oracle ASM Data Migration.......................................................................................... 8-1 Purpose of Oracle ASM Data Migration......................................................................................... 8-1 Basic Concepts of Oracle ASM Data Migration............................................................................. 8-2 Basics Steps of Data Migration to Oracle ASM Using RMAN.................................................... 8-2 Preparing to Migrate the Database to Oracle ASM Using RMAN................................................. 8-3 Migrating the Database to Oracle ASM Using RMAN.................................................................... 8-5 Migrating a Database from Oracle ASM to Alternative Storage.................................................... 8-9 Moving Data Files Between Oracle ASM Disk Groups Using RMAN......................................... 8-9 9 Administering Oracle ASM with Oracle Enterprise ManagerOracle Automatic Storage Management Home Page........................................................................ 9-1 Accessing the Oracle ASM Home Page in Single-Instance Oracle Databases ......................... 9-2vii。
Oracle Identity Manager 11g 用户手册说明书

ORACLE DATA SHEETORACLE DATA SHEETContact UsFor more information about Oracle Identity Management, visit or call +1.800.ORACLE1 to speak to an Oracle representative.Copyright © 2011, Oracle and/or its affiliates. All rights reserved.This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subjectto any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose.We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may notbe reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. UNIX is a registered trademark licensed through X/Open Company, Ltd. 1010。
第3部分 oracle11g用户和权限管理

Oracle11g基础--对象权限
授予精确到列上的权限
grant update(ename,sal) on scott.emp to wang;
允许用户更新 emp 表中的ename、sal列
Oracle11g基础—角色管理
收回系统权限REVOKE 例:REVOKE create session FROM test1;
GRANT 命令可用于为用户分配权限或角色
GRANT CREATE SESSION TO wang;
此系统权限允许用户连接到数据库上
GRANT CREATE TABLE TO wang;
赋给wang用户以创建表的系统权限
Oracle 默认用户
SYS
SYSTEM
SCOTT
数据库中所有数据字典表和视图都存储在 SYSTEM 是默认的系统管理员,该用户拥有 SYS Oracle 模式中。 管理工具使用的内部 SYS用户主要用 SCOTT用户是Oracle 数据库的一个示范帐户,在数据库安装时创建 来维护系统信息和管理实例。 表和视图。通常通过SYSTEM用户管理数据库用户、权限和存储等
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 角色管理:角色是一组相关权限的组合,可以将权限授予角 色,再把角色授予用户,以简化权限管理。 (1)创建角色CREATE ROLE,应该具有CREATE ROLE系统权限。 CREATE ROLE role_name; (2) 授予角色权限,可以是系统权限或者对象权限。 GRANT privilege TO ROLE; 例: grant create session ,create any table, drop any table to role1; (3) 将角色授予用户 GRANT role TO user; 例: grant role1 to test2; (4) 从用户收回角色 REVOKE role FROM user;
第3章 Oracle 11g 的管理工具

3.3.2 SQL*PLUS的编辑功能
• SQL*PLUS的文件操作命令举例:
– (2).GET 语句
• 将文件中的内容装入到缓冲区中,以便执行或进一 步编辑。 • 语句格式:GET filename • 实例:将保存在E盘student文件夹中的文件 queryByName.sql装入缓冲区。 • SQl> get e:\student\queryByName.sql
3.3.2 SQL*PLUS的编辑功能
• SQL*PLUS的文件操作命令举例:
– (2).start语句
• 执行文件。 • 语句格式:STA[RT] filename • 实例:运行磁盘上的命令文件。 • SQL>start e:\student\queryByName.sql
3.3.3 退出SQL*PLUS
从当前行删除text
删除缓冲区中的所有行 删除当前行 删除第n行 删除从第m行到第n行的所有内容(n可以是LAST) 在当前行后面添加一个ST] n
L[IST] m n L[IST] * R[UN]
列出第n行
列出第m至第n行 列出所有行 显示并运行缓冲区中的当前命令
第3章 Oracle 11g的常用工具
学习目的
• 掌握数据库配置助手(Database Configuration Assistant,DBCA)的功能 和使用方法; • 掌握Oracle企业管理器(Oracle Enterprise Manager,OEM)的功能和使用方法; • 掌握SQL*PLUS的功能和使用方法。
n
n text o text
将第n行设置为当前行
用text文本的内容替代第n行 在第一行之前插入text指定的文本
oracle11g教程从入门到精通

韩顺平—玩转oracle视频教程笔记一:Oracle认证,与其它数据库比较,安装Oracle安装会自动的生成sys用户和system用户:(1)sys用户是超级用户,具有最高权限,具有sysdba角色,有create database的权限,该用户默认的密码是change_on_install(2)system用户是管理操作员,权限也很大.具有sysoper角色,没有create database的权限,默认的密码是manager(3)一般讲,对数据库维护,使用system用户登录就可以拉也就是说sys和system这两个用户最大的区别是在于有没有create database的权限。
二: Oracle的基本使用——基本命令sql*plus的常用命令连接命令1。
conn[ect]用法:conn 用户名/密码@网络服务名[as sysdba/sysoper]当用特权用户身份连接时,必须带上as sysdba或是as sysoper2。
disc[onnect]说明:该命令用来断开与当前数据库的连接3.psssw[ord]说明: 该命令用于修改用户的密码,如果要想修改其它用户的密码,需要用sys/system登录。
4.show user说明: 显示当前用户名5.exit说明: 该命令会断开与数据库的连接,同时会退出sql*plus文件操作命令1。
start和@说明:运行sql脚本案例: sql>@ d:\a。
sql或是sql〉start d:\a.sql2.edit说明: 该命令可以编辑指定的sql脚本案例: sql>edit d:\a.sql,这样会把d:\a。
sql这个文件打开3。
spool说明: 该命令可以将sql*plus屏幕上的内容输出到指定文件中去。
案例: sql>spool d:\b。
sql 并输入 sql>spool off交互式命令1。
&说明:可以替代变量,而该变量在执行时,需要用户输入。
Oracle11g的管理工具

3.3 SQL*Plus
• SQL*Plus的主要功能包括:
– 插入、修改、删除、查询数据,以及执行SQL、 PL/SQL块;
– 查询结果的格式化、运算处理、保存、打印输出; – 显示表的定义,并与终端用户交互; – 连接数据库,定义变量; – 完成数据库管理; – 运行存储在数据库中的子程序或包; – 启动/停止数据库实例。
• SQL*Plus是Oracle公司在SQL基础上经过扩充的 语言,它也是一种开发环境,可以运行在任何 Oracle平台上。SQL*Plus可以执行输入的SQL语 句和包含SQL语句的文件,通过SQL*Plus可以与 数据库进行交互,开发数据库应用程序,使用户 可以根据需要完成对数据库中数据的检索、格式 化和控制等操作。
• 在SQL*Plus中,从“SQL>”提示符输入命令或者 SQL语句时,命令以分号结束,然后按回车键执 行。如果SQL语句的结尾没有“;”,SQL*Plus 会认为语句还没有结束,自动转换到下已行等待 输入。
• SQL*Plus可以执行SQL语句,语句执行完成后, 保存在一个被称为SQL buffer的内存区域中,并 且只能保存一条最近执行的SQL语句,可以对保 存在SQL buffer中的SQL语句进行修改,然后再 次执行。
3.3.2 SQL*PLUS的编辑功能
• 除了SQL *Plus语句,在SQL *Plus中执行 的其它语句我们称之为SQL *Plus命令。它 们执行完后,不保存在SQL buffer的内存区 域中,它们一般用来执行编辑功能或者对 输出的结果进行格式化显示,以便于制作 报表。
3.3.2 SQL*PLUS的编辑功能
第3章 Oracle 11g的常用工具
学习目的
• 掌握数据库配置助手(Database Configuration Assistant,DBCA)的功能 和使用方法;
Oracle 11g 数据库管理基础

[键入文字]眺望Oracle1 1g 数据库管理基础一Oracle 官方文档翻译北极熊2013年32周 (1)1开始数据库管理 (2)1.1各种Oracle数据库用户 (2)1.1.1数据库管理员 (2)1.1.2安全人员 (2)1.1.3网络管理员 (3)1.1.4应用开发者 (3)1.1.5应用管理者 (3)1.1.6数据库用户 (3)1.2数据库管理员的任务 (3)1.2.1评估数据库服务器硬件 (3)1.2.2安装数据库软件 (4)1.2.3规划数据库 (4)1.2.4建立并打开数据库 (4)1.2.5备份数据库 (4)1.2.6登记系统用户 (4)1.2.7实现数据库设计 (5)1.2.8备份完整功能的数据库 (5)1.2.9调优数据库性能 (5)1.2.10下载并安装补丁 (5)1.2.11滚动安装到附加主机 (5)1.3在数据库中运行命令和SQL (6)1.3.1关于SQL*Plus (6)1.3.2使用SQL连接到数据库 (6)1.4标识你的数据库发行版本 (9)1.4.1检查当前版本号 (9)1.5关于数据管理员安全与权限 (10)1.5.1数据库管理员的操作系统账号: (10)1.5.2管理员账号: (10)1.6数据库管理员认证 (10)1.6.1管理员权限 (10)1.6.2SYSDBA和SYSOPER (11)1.6.3作为SYSDBA连接的例子 (11)1.6.4选择数据库管理员认证方法 (12)1.7建立和维护密码文件 (13)1.7.1建立密码文件 (13)1.7.2密码文件参数描述 (14)共享和禁用密码文件 (14)1.7.4保持管理员密码和数据字典同步 (15)1.7.5管理密码文件 (15)1.8数据工具 (15)1.8.1SQL*Loader (15)1.8.2Export和Import 工具 (16)本章真正的很基础,很基础。
说实话翻译时就感觉是练习练习英文,有点基础都跳过或是有选择的看一点吧。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
第一部分用户账户与权限再讲之前先考虑一个问题,如果现在使用oracle数据库的时候忘记了密码怎么办?可能有同学想到可以用sys用户找回密码,如果连sys用户密码都忘了呢?还有什么办法吗?1、数据库中存在的用户具有OPEN,LOCK,EXPIRE三种状态,查看当前的数据库已经启用的(OPEN)用户情况使用表dba_users2、创建用户的基本命令:create user 新的用户名 identified by密码;创建一个test1的用户,密码为123create user test1 identified by 123;用户创建好了,大家试一下用新用户登陆数据库是否可以?3、授予用户权限的命令:grant 权限名/角色名 to 用户;将create session的权限给test1用户grant create session to test1;4、修改用户密码命令:alter user 用户名 identified by 新密码;将用户test1的密码由123改为test1;(想一下谁有权利改?)alter user test1 identified by test1;5、设置用户密码过期命令:alter user 用户名 password expire;将用户test1的密码设置为过期状态,使用dba_tables查看一下当前账户的状态,现在test1使用test1的密码还能登陆吗,出现什么现象?alter user test1 password expire;6、设置用户锁定/解锁:alter user 用户名 account lock/unlock;将用户test1设置锁定,使用test1还能登陆吗?alter user test1 account lock;7、解锁test1用户,使用test1登陆,创建一张表:create table mytab(id number,name varchar2(50));可以创建吗?8、为用户授与相关的权限:grant 权限名 to 用户;为用户授予创建表的权限:g rant create table to test1;再试一下可以创建表了吗?9、使用test1用户查询一下scott用户下的emp表的ename,empno,job列:s elect ename,empno,job from emp;可以吗?select ename,empno,job from scott.emp;这样可以吗?10、为用户test1授予查询scott.emp表的权限(使用sys用户授予)grant select on scott.emp to test1;试一下可以使用用户test1往scott.emp插入数据吗?主要权限:insert、delete、update、selectgrant select,insert on scott.emp to new;11、回收test1用户的查询、插入scott.emp表的权限revoke select,insert on scott.emp from new;12、删除用户drop user new cascade;(级联删除)13、通过以上命令可以看出,创建一个用户再为这个用户授予相关的权限是比较复杂的,所以oracle中引入了角色的概念,只要创建一个用户后将相应的权限授予这个用户即可。
新建一个用户test2/123,为用户授予connect和resource权限:create user test2 identified by 123;grant connect,resource to test2;现在试一下使用test2用户是否可以登录、创建表呢?预定义角色预定义角色是指Oracle所提供的角色,每种角色都用于执行一些特定的管理任务,下面我们介绍常用的预定义角色connect,resource,dba。
connect角色connect角色具有一般应用开发人员需要的大部分权限,当建立了一个用户后,多数情况下,只要给用户授予connect和resource角色就够了,那么connect角色具有以下系统权限:alter sessioncreate clustercreate database linkcreate sessioncreate viewcreate sequenceresource角色resource角色具有应用开发人员所需要的其他权限,比如建立存储过程、触发器等。
这里需要注意的是resource角色隐含了unlimited tablespace系统权限。
resource角色包含以下系统权限:create clustercreate indextypecreate tablecreate sequencecreate typecreate procedurecreate triggerdba角色dba角色具有所有的系统权限,及with admin option选项,默认的dba用户为sys和system他们可以将任何系统权限授予其他用户。
但是要注意的是dba角色不具备sysdba和sysoper的特权(启动和关闭数据库)。
如果要了解用户拥有哪些角色,以及角色中包含哪些权限,可以查看表中所示的数据字典视图。
第二部分:用户配置文件Oracle安装完成后,自动创建了名为default的资源配置文件,可以通过以下命令查看(查看dba_profiles表):从查询结果(profile文件名,resource_name资源名,limit资源限制)中可以看出在名为default的profile中有16个resource_name,每一个resource_name 都可以做限制。
下面让我们来认识以下这16个resource_name以及它们的作用:1、COMPOSITE_LIMIT:由多个资源限制参数构成的复杂限制参数,利用该参数可以对所有混合资源进行设置。
2、SESSIONS_PER_USER:每个用户可以拥有的会话数,即同时最多可以有几个客户端使用这个用户登陆数据库(用户的并发个数)。
3、CPU_PER_SESSION:每个会话可以占用的CPU总时间,其单位为百分之一秒。
4、CPU_PER_CALL:每条SQL语句可以占用的CPU的总时间,其单位为百分之一秒。
5、LOGICAL_READS_PER_SESSION:每个会话期间可以读取的数据块数量,从内存中读取的数据块和从磁盘中读取的数据块。
6、LOGICAL_READS_PER_CALL:每条SQL语句可以读取的数据块数量。
7、IDLE_TIME:空闲时间——用户非活动检测时间,多长时间没有做动作就自动断开(单位:min)。
8、CONNECT_TIME:用户可以连接到数据库的总时间(单位:min),即连接多久用户会自动退出。
9、PRIV ATE_SGA:每个用户占用多少内存区域(单位:bytes),共享服务器模式下有效。
在专用服务器模式下,这个参数不起作用。
10、FAILED_LOGIN_ATTEMPTS:用户登录数据库时允许失败的次数,达到失败次数后,该用户将自动锁定,锁定时间取决于PASSWORD_LOCK_TIME。
11、PASSWORD_LIFE_TIME:用户口令的有效时间,单位为天。
12、PASSWORD_REUSE_TIME:用于设置一个失效口令多少天之内不允许使用。
13、PASSWORD_REUSE_MAX:用于设置一个已使的口令被重新使用之前,口令必修被修改的次数。
14、PASSWORD_VERIFY_FUNCTION:设置用于判断口令复杂性的函数,函数可以自动创建,也可以使用默认的或不使用。
15、PASSWORD_LOCK_TIME:用户登录失败次数达到限制数,用户将被锁定的时间,单位为天。
16、PASSWORD_GRACE_TIME:当口令的使用时间达到密码到期时间时,该口令还允许使用的“宽限时间”,用户登录时,Oracle会提示该时间。
使用下面的命令可以查看Oracle的用户所使用的参数文件(一般为default)可以看到大多数的用户使用的都是DEFAULT的profile文件,就是我们在上面查看的哪一个。
下面我们自己创建一个profile文件:注意要用DBA的身份才能创建profile文件,我们使用SYS用户来创建:要求:(1)限制用户允许拥有的会话数为1,对应的参数为SESSIONS_PER_USER (2)限制用户空闲时间的有效时间为1分钟,对应的参数为IDLE_TIME (3)限制用户登录数据库可以失败的次数为3次,对应的参数为FAILED_LOGIN_ATTEMPTS(4)设置用户登录失败次数达到限制次数时,用户被锁定的时间为5分钟,对应的参数为PASSWORD_LOCK_TIME(5)设置用户连接数据库的时间为5分钟,超出这个时间将断开数据库,对应的参数文件为CONNECT_TIME(6)设置口令使用时间达到有效时间之后,口令任然可以使用的“宽限时间”为3天,对应的参数为PASSWORD_GRACE_TIME创建配置文件的格式为:create profile 用户配置文件名称limit参数1 限制大小参数2 限制大小参数3 限制大小……参数n 限制大小;创建之后可以通过下面的命令来查看已经创建的profile,其中dba_profile表记录的是当前oracle之下的所用的profile,我们使用where筛选出刚刚创建的myprofile当然在绑定后要想让这个参数文件里的限制生效还要修改系统parameter resource_limit,使绑定的参数文件里的限制生效:将用户绑定到参数文件有两种方法:1、在创建用户的时候绑定参数文件:Create user 用户名identified by 密码Profile 绑定的参数名;2、在之后为用户修改绑定的参数文件:Alter user 用户名profile 要绑定的参数名;关于PASSWORD_VERIFY_FUNCTION的使用:profile的PASSWORD_VERIFY_FUNCTION参数,允许我们在创建用户或者更改用户密码时实施自定义的密码验证规则。
首先,我们需要创建一个自己的实现密码验证规则的函数,该函数必须创建在sys模式下,而且必须有三个类型为varchar2的输入参数,第一个参数,包含我们要修改的用户名,第二个参数包含新密码,第三个参数包含旧密码,并且返回类型为布尔类型。
举一个简单的例子,如果我们需要使密码最少保6位,并在用户修改密码时在passwd_changed表中记录用户的旧密码和新密码:首先创建表passwd_changed:create table passwd_changed (user_name varchar2(20) ,old_passwd varchar2(20) ,new_passwd varchar2(20)) ;创建实现密码自定义规则的函数my_password_verify:CREATE OR REPLACE FUNCTION my_password_verify(username V ARCHAR2 ,password V ARCHAR2 ,old_password V ARCHAR2) RETURN BOOLEAN ISBEGINIF LENGTH(password) < 6 THENraise_application_error(-20001,'密码的长度至少6位');END IF;INSERT INTO passwd_changedV ALUES(username,old_password,password);RETURN(TRUE);END;/第三部分:管理用户Session数据库管理员可以在需要的时候使用ALTER SYSTEM语句终止用户的会话,其语法形式如下:ALTER SYSTEM KILL SESSION ' sid , serial# ' ;其中,sid与serial#的值可以通过查询动态视图v$session获得。