Home Database Mysql Tutorial 《Oracle DBA日常工作和职责》

《Oracle DBA日常工作和职责》

Jun 07, 2016 pm 05:41 PM
object

《OracleDBA日常工作和职责》1.数据库环境LEO1@LEO1select*fromv$version;BANNER---------------------------------------------------------------------------

《Oracle DBA日常工作和职责》

1.数据库环境

LEO1@LEO1> select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

PL/SQL Release 11.2.0.1.0 - Production

CORE    11.2.0.1.0      Production

TNS for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

2.用SQL计算出你所用数据库的总容量,给出SQL语句和结果。

如果要计算数据库的总容量就需要知道数据库由哪几部分组成的,然后计算每部分的容量之和即可

(1)数据文件

路径:/u01/app/oracle/oradata/LEO1/

数据文件名           字节           M

leo1_01.dbf           419438592      400M

sysaux01.dbf          639639552      610M

system01.dbf          734011392      700M

undotbs01.dbf         173023232      165M

users01.dbf            5251072        5M

我们看一下对应表空间的使用情况

LEO1@LEO1> select df.tablespace_name "表空间名",totalspace "总空间M",freespace "剩余空间M",round((1-freespace/totalspace)*100,2) "使用率%"

from

(select tablespace_name,round(sum(bytes)/1024/1024) totalspace from dba_data_files group by tablespace_name) df,

(select tablespace_name,round(sum(bytes)/1024/1024) freespace from dba_free_space group by tablespace_name) fs

where df.tablespace_name=fs.tablespace_name order by df.tablespace_name ;  2    3    4    5  

表空间名            总空间M   剩余空间M   使用率%

--------------------------------------------------------------------------------------

LEO1                400           237      40.75

SYSAUX              610           31       94.92

SYSTEM              700           8        98.86

UNDOTBS1           165           137      16.97

USERS               5             4        20

(2)临时文件

路径:/u01/app/oracle/oradata/LEO1/

临时文件名           字节            M

temp01.dbf           128983040       123

我们看一下对应表空间的使用情况

LEO1@LEO1> select file_name,tablespace_name,bytes/1024/1024,user_bytes/1024/1024 from dba_temp_files;

FILE_NAME                              TABLESPACE_NAME         BYTES/1024/1024

--------------------------------------------------------------------------------------------------------------------------------------------

/u01/app/oracle/oradata/LEO1/temp01.dbf    TEMP                    123                  

(3)重做日志文件

路径:/u01/app/oracle/oradata/LEO1/

重做日志文件名     字节             M

redo01.log          52429312         50

redo02.log          52429312         50

redo03.log          52429312         50

三个是镜像关系,所以大小都一样

(4)控制文件

路径:/u01/app/oracle/oradata/LEO1/

控制文件名        字节              M

control01.ctl        9748480          9.29

control02.ctl        9748480          9.29

control03.ctl        9748480          9.29

三个也是镜像关系,所以大小都一样,控制文件的大小会根据数据库结构的变化而变化

(5)参数文件

路径:/u01/app/oracle/product/11.2.0/db_1/dbs

参数文件名        字节              M

spfileLEO1.ora       2560             0.003

参数文件是描述数据库属性的,记录了数据库非默认值的所有初始化参数

(6)告警日志

路径:/u01/app/oracle/diag/rdbms/leo1/LEO1/trace

告警日志          字节              M

alert_LEO1.log      2271951           2.166

告警日志记录数据库中所有的报错信息,会随着信息量的多少而变化,我们也可以清空告警日志

(7)密码文件

路径:/u01/app/oracle/product/11.2.0/db_1/dbs

密码文件名        字节              M

orapwLEO1         1536             0.002

密码文件保存着数据库管理员信息(ID passwd),只要数据库添加管理员就会在这里添加对应的信息

(8)dump文件和归档日志

Adump

Bdump

Cdump

Udump

这些都是记录数据库信息的日志文件,把它们的容量加在一起就是数据库总容量了

数据库容量公式:数据文件+临时文件+重做日志文件+控制文件+参数文件+告警日志+密码文件+……

Count:(400+610+700+165+5)+123+(50+50+50)+(9.29+9.29+9.29)+0.003+2.166+0.002=2183.041M

小结:所谓数据库就是文件的集合,那么数据库容量就是文件集合的容量。

3.用SQL计算出某个用户下所有对象的大小,给出SQL语句和结果。

我们要计算用户的所有对象就是计算一个schema的大小

段对象:凡是分配存储空间的对象就叫段对象

我最常用的用户名LEO1,下面我们就来看看这个用户的schema的所有对象

LEO1@LEO1> select owner,segment_name,segment_type,partition_name,bytes from dba_segments where owner='LEO1';

OWNER    SEGMENT_NAME   SEGMENT_TYPE     PARTITION_NAME       BYTES

------------------------------ ---------------------------------------- ------------------ -------------------- ----------

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What are the methods of converting java Object to byte and byte to Object? What are the methods of converting java Object to byte and byte to Object? Apr 20, 2023 am 11:37 AM

Object to byte and byte to Object Today we will realize how to convert from Object to byte and how to convert from byte to Object. First, define a class student: packagecom.byteToObject;importjava.io.Serializable;publicclassstudentimplementsSerializable{privateintsid;privateStringname;publicintgetSid(){returnsid;}publicvoidsetSid(in

How to use methods in Java Object class How to use methods in Java Object class Apr 18, 2023 pm 06:13 PM

1. Introduction to the Object class Object is a class provided by Java by default. Except for the Object class, all classes in Java have inheritance relationships. By default, it will inherit the Object parent class. That is, objects of all classes can be received using the reference of Object. Example: Use Object to receive objects of all classes classPerson{}classStudent{}publicclassTest{publicstaticvoidmain(String[]args){function(newPerson());function(newStudent());}public

PHP Notice: Trying to get property of non-object solution PHP Notice: Trying to get property of non-object solution Jun 24, 2023 pm 09:34 PM

PHPNotice: Tryingtogetpropertyofnon-object Solution When you are developing in PHP, you may encounter this error message: "Notice: Tryingtogetpropertyofnon-object." This error message is usually due to you using an uninitialized object, or It's because your object has lost its reference in a certain piece of code and cannot access the properties correctly.

Java uses the getClass() function of the Object class to obtain the runtime class of the object Java uses the getClass() function of the Object class to obtain the runtime class of the object Jul 24, 2023 am 11:37 AM

Java uses the getClass() function of the Object class to obtain the runtime class of the object. In Java, each object has a class, which defines the properties and methods of the object. We can use the getClass() function to get the runtime class of an object. The getClass() function is a member function of the Object class, so all Java objects can call this function. This article will introduce how to use the getClass() function and give some code examples. use get

Solution to PHP Notice: Trying to get property of non-object Solution to PHP Notice: Trying to get property of non-object Jun 22, 2023 pm 02:43 PM

Solution to PHPNotice: Tryingtogetpropertyofnon-object In the process of writing code in PHP, we may encounter the error message "Tryingtogetpropertyofnon-object". This error message usually occurs because we are trying to access a non-existent object property, causing an error in the code. This error message usually appears in the following situations: The object does not exist

What is the relationship between basic data types and Object in java What is the relationship between basic data types and Object in java May 01, 2023 pm 04:04 PM

The relationship between basic data types and Object. I know everyone has heard that Object is the base class of all types, but this sentence is actually not correct, because the basic data types in Java have nothing to do with Object. Here are some examples For example, when calling the swap method, you cannot directly pass the int type to the swap(Objectobj) method, because Object actually has nothing to do with the basic data type. At this time, a finds that our types do not match, so it automatically wraps it. It has become an Integer type. At this time, it can be contacted with Object and the swap method can be successfully called. Object, a wrapper class of basic data types

How to use Java Object class How to use Java Object class May 13, 2023 pm 05:13 PM

1.equals method == operator comparison operator, which can determine both the basic type and the reference type. If the basic type is determined, it is determined whether the values ​​are equal. If the reference type is determined, it is determined whether the addresses are equal, that is, whether they are the same object. equals is a method of the object class and can only determine the reference type object-equals source code: publicbooleanequals(Objectobj){return(this==obj);} It can be clearly seen that the equals method in the object class is to determine whether the address of the object is The same (is it the same object), but other data type classes will override the equals method, such as

How to convert object to array in php How to convert object to array in php Aug 04, 2023 pm 05:26 PM

Method of converting object to array in PHP: 1. Use the type conversion function ((array)), PHP will use the public properties of the object as the key, and the value of the property as the corresponding array value; 2. Use the reflection class (ReflectionClass), through reflection With the `getProperties()` method of the class, we can get all the properties of the object. Then, pass the `setAccessible(true)` method and so on; 3. Use json_encode().

See all articles