表空间

oracle学习篇:二、参数文件

允我心安 提交于 2019-12-02 14:56:37
2 参数文件 2.1 参数文件的获取 oracle的初始化参数可以通过查询v$parameter视图得到,在SQL*PLUS中,可以用过show parameter命令来显示某些参数的设置值。 2.2 参数文件 初始化参数文件:pfile 服务器参数文件:spfile 视图v$spparamter记录spfile参数的设置。 没啥好说的,直接学习一下案例分析。 2.3 诊断案例 问题描述:数据库在重新启动时无法正常启动,检查发现undo表空间丢失。 2.3.1 检查alert日志文件 警报日志文件由按时间排序的消息和错误的记录组成。下列信息会记录在警报日志文件中: (1)内部错误和块损坏 (2)影响数据库结构和参数的操作 (3)例程启动时所有非缺省的初始化参数值 控制警报日志文件位置的初始化参数为:background_dump_dest,缺省文件名为alertorcl.log 查看oracle错误含义:oerr ora 30012(今天才发现oracle错误可以这么查,授人以鱼不如授人以渔啊) 检查警报日志,发现报错原因ora-30012:undo表空间不存在。 2.3.2 尝试重新启动 数据库,检查问题是否仍然存在 startup 启动失败,问题仍然存在 2.3.3 检查数据文件,看undo表空间是否存在 ls -ltr undotbs.dbf 文件存在 2.3.4

oracle中创建用户、角色、权限、表空间简单使用

久未见 提交于 2019-12-02 12:44:39
一、数据库用户 创建数据库用户   create user 用户名 identified by 密码; 授权   grant 权限名 to 用户名; 查看当前用户权限   select * from session_privs; 移除权限   revoke 权限 session from 用户名; 用户解锁/锁定   alter user 用户名 account unlock/lock; 二、角色   角色:权限组,多种权限的集合,将角色赋予某个用户时即是将其包含权限一次性赋予该用户;   常用系统角色 dba     拥有对数据库的所有操作权限,包括创建用户,其中system用户拥有该权限   2. connect     具有创建会话、修改会话等权限   3. resource     具有创建表、视图、存储(create procedure)等权限 创建角色(在system用户下创建)   create role 角色名称; 赋予权限   grant 权限名… to 角色名称 查看当前用户角色   select * from user_role_privs; 查看当前用户角色的所有权限   select * from role_sys_privs; 查询角色权限   select * from dba_sys_privs where grantee = '角色名'(区分大小写

Oracle常用命令

喜夏-厌秋 提交于 2019-12-02 11:31:27
一、ORACLE的启动和关闭 1、在单机环境下 要想启动或关闭ORACLE系统必须首先切换到ORACLE用户,如下 su - oracle a、启动ORACLE系统 oracle>svrmgrl SVRMGR>connect internal SVRMGR>startup SVRMGR>quit b、关闭ORACLE系统 oracle>svrmgrl SVRMGR>connect internal SVRMGR>shutdown SVRMGR>quit 启动oracle9i数据库命令: $ sqlplus /nolog SQL*Plus: Release 9.2.0.1.0 - Production on Fri Oct 31 13:53:53 2003 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. SQL> connect / as sysdba Connected to an idle instance. SQL> startup^C SQL> startup ORACLE instance started. 2、在双机环境下 要想启动或关闭ORACLE系统必须首先切换到root用户,如下 su - root a、启动ORACLE系统 hareg -y oracle b、关闭ORACLE系统

oracle常用语句

你。 提交于 2019-12-02 08:17:41
create tablespace chen1 datafile 'E:\app\chendabing\oradata\test\chen1.dbf' size 100m autoextend on next 50m maxsize 20480m extent management local / 创建表空间 ORA-01031:权限不足的问题 在 脚本更新时,报错:ORA-01031: 权限不足。 grant connect,resource,dba to cssy; 赋权DBA之后,还有这个错误。 执行 grant all privileges to cssy 赋予任何主机访问数据的权限,问题得到了解决。 --删除空的表空间,但是不包含物理文件 drop tablespace tablespace_name; --删除非空表空间,但是不包含物理文件 drop tablespace tablespace_name including contents; --删除空表空间,包含物理文件 drop tablespace tablespace_name including datafiles; --删除非空表空间,包含物理文件 drop tablespace tablespace_name including contents and datafiles; -

Oracle数据泵常用命令

流过昼夜 提交于 2019-12-02 05:03:48
前言 expdp和impdp是oracle数据库之间移动数据的工具。expdp和impdp只能在数据库服务端使用,不能在客户端使用。本文简单总结了expdp和impdp常用的命令,详细信息参考oracle官方文档Utilities。 directory相关SQL语句: select * from dba_directories; create directory my_dir as ‘/home/oracle/tmp’; grant read,write on directory my_dir to scott; expdp 注意: 1、导数的数据库用户需要拥有对directory_object的读写权限。 2、操作系统中需要已经存在directory_object指定的路径。 3、oracle用户拥有对directory_object指定路径的读写权限。 4、system用户导出用户,会将创建用户和授予系统权限的元数据也导出,普通用户不能导出这些元数据。 expdp命令示例 导出一张表,例: expdp system/oracle directory=my_dir dumpfile=expdp.dmp logfile=expdp.log tables=scott.emp 导出多张表,例: expdp system/oracle directory=my_dir dumpfile

oracle的用户、权限、表空间的管理

左心房为你撑大大i 提交于 2019-12-02 04:52:49
1、创建表空间 create tablespace test1_tablespace datafile 'test1file.dbf' size 10m; 2、创建临时表空间 create temporary tablespace temptest1_tablespace tempfile 'tempfile1.dbf' size 10m; 3、查看创建的表空间的位置 select file_name from dba_data_files where tablespace_name='TEST1_TABLESPACE'; 4、查看创建的临时表空间的位置 select file_name from dba_temp_files where tablespace_name='TEMPTEST1_TABLESPACE'; 5、创建用户 create user wyl identified by 123456 default tablespace test1_tablespace temporary tablespace temptest1_tablespace; 6、查看用户 select username from dba_users; 7、授予用户连接数据库的权限 grant connect to wyl; 8、 连接到用户 wyl 9、更改密码 alter user wyl

Ora 命令行建立账号

风格不统一 提交于 2019-12-02 02:38:24
1.使用cmd 进入 sqlplus /nolog conn system/ as sysdba 2.修改密码 alter user ebthis identified by new_psw; 3.查看用户 select username,password from dba_users; 4.在创建用户之前,先要创建表空间 create tablespace test_tablespace datafile ‘d:\oracle\oradata\test\test.dbf’ size 1024M autoextend on next 200M maxsize unlimited; 删除表空间 alter tablespace test_tablespace offline; drop tablespace test_tablespace including contents and datafiles; 5.创建用户 create user ebthis IDENTIFIED BY ebthispwd --用户密码 default tablespace test_tablespace-- 表空间是上面创建的 temporary tablespace TEMP -- 临时表空间默认 TEMP profile DEFAULT; 6.授权 grant connect,resource

【Oracle】 RMAN命令汇总

旧街凉风 提交于 2019-12-02 02:05:03
RMAN命令汇总 2013年写了关于RMAN命令的汇总,先转换为MD文档,温故而知新。 1.进入RMAN 进入本地数据库 [oracle@oracle-n1 ~]$ rman target / 进入远程数据库 [oracle@oracle-n1 ~]$ rman target zsd/zsd@zsddb_1.9 使用日志功能 [oracle@oracle-n1 logs]$ rman target / msglog /data/backup/logs/full_dbbackup_`date +%y%m%d`.log 2.RMAN基础命令 启动关闭数据库 RMAN> shutdown immediate RMAN> startup 执行操作系统命令 RMAN> host 执行SQL语句 RMAN> SQL 'ALTER SYSTEM SWITCH LOGFILE'; 需要注意的一点是,rman中的sql环境不能执行SELECT语句,就算执行不报错,也不出结果。 RMAN> SQL 'select * from member.test'; sql statement: select * from member.test (可以看出没有任何数据显示) 查看默认RMAN配置 RMAN>show all; CONFIGURE RETENTION POLICY TO REDUNDANCY 1;

【Oracle】重做undo表空间

眉间皱痕 提交于 2019-12-02 02:03:54
重做undo表空间 场景: alert日志,报了如下错误: [oraprod@arpinfo bdump]$ tail -f alert_PROD.log Errors in file /ora1159/prod/proddb/9.2.0/admin/PROD_arpinfo/udump/prod_ora_8729.trc: ORA-00603: ORACLE server session terminated by fatal error ORA-00600: internal error code, arguments: [4097], [], [], [], [], [], [], [] Fri Sep 6 10:08:56 2019 Errors in file /ora1159/prod/proddb/9.2.0/admin/PROD_arpinfo/udump/prod_ora_8785.trc: ORA-00600: internal error code, arguments: [4097], [], [], [], [], [], [], [] Fri Sep 6 10:08:59 2019 Errors in file /ora1159/prod/proddb/9.2.0/admin/PROD_arpinfo/udump/prod_ora_8785.trc:

oracle个人常用sql

怎甘沉沦 提交于 2019-12-02 01:59:59
--创建表空间 create tablespace yjzdjs_data datafile 'F:\oracle_data\yjzdjs_data.dbf' size 500M; --创建用户 create user zdjs identified by zdjs; --修改用户的密码 alter user zzg identified by unis; --授权部分权限给用户 grant create session,create table,create view,create sequence,unlimited tablespace to yjzdjs; --授权dba权限给用户 grant dba to zdjs; --授权表空间给用户 alter user zdjs default tablespace yjzdjs_data; --查询某个用户的表空间名称(用户名要大写) select username ,default_tablespace from dba_users where username='ZDJS'; --查询所有用户以及对应的表空间 select username ,default_tablespace from dba_users ; --登录 conn zdjs/zdjs; --登录之后我们也可以来查询用户所具有的权限 select *