创建测试用户snow,该用户拥有一个表,一个存储过程,一项任务起作用很简单,就是模拟一个用户每分钟像数据库插入一条时间戳,产
实验环境简介:
创建测试用户snow,,该用户拥有一个表,一个存储过程,一项任务起作用很简单,就是模拟一个用户每分钟像数据库插入一条时间戳,产生数据库行为。在备份与恢复的过程中,该时间戳可以检测恢复操作是否顺利完成。
--------------------------------------推荐阅读 --------------------------------------
RMAN 配置归档日志删除策略
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密
--------------------------------------分割线 --------------------------------------
查看数据库名称和归档模式
SYS@PRACTICE >col name for a10
SYS@PRACTICE >col log_mode for a10
SYS@PRACTICE >select name, log_mode from v$database;
NAME LOG_MODE
---------- ----------
PRACTICE ARCHIVELOG
查看数据库版本
SYS@PRACTICE >select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
数据文件
SYS@PRACTICE >col name for a40
SYS@PRACTICE >select name,bytes/1024/1024 MB from v$datafile;
NAME MB
---------------------------------------- ----------
/oradata/PRACTICE/system01.dbf 710
/oradata/PRACTICE/sysaux01.dbf 570
/oradata/PRACTICE/undotbs01.dbf 110
/oradata/PRACTICE/users01.dbf 5
/oradata/PRACTICE/example01.dbf 313.125
/oradata/PRACTICE/tools01.dbf 20
/oradata/PRACTICE/indx.dbf 20
下面的语句也可以显示同样的数据
select file_name, bytes/1024/1024 MB from dba_data_files;
查看联机重做日志的位置和大小
SYS@PRACTICE >select member,bytes/1024/1024 MB from v$logfile lf, v$log l where lf.group# = l.group#;
MEMBER MB
------------------------------------------------------------ ----------
/oradata/PRACTICE/redo03.log 50
/oradata/PRACTICE/redo02.log 50
/oradata/PRACTICE/redo01.log 50
查看控制文件的位置
SYS@PRACTICE >col name for a100
SYS@PRACTICE >select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/oradata/PRACTICE/control01.ctl
/u01/app/oracle/fast_recovery_area/PRACTICE/control02.ctl
查看临时文件的位置及大小
SYS@PRACTICE >select name,bytes/1024/1024 MB from v$tempfile;
NAME MB
---------------------------------------- ----------
/oradata/PRACTICE/temp01.dbf 29
创建测试用户SNOW
GRANT CONNECT, RESOURCE, UNLIMITED TABLESPACE TO snow IDENTIFIED BY snow;
ALTER USER snow DEFAULT TABLESPACE TOOLS;
ALTER USER snow TEMPORARY TABLESPACE TEMP;
创建时间戳表
CONNECT snow/snow
DROP TABLE date_log;
CREATE TABLE date_log (
create_time DATE CONSTRAINT create_date_pk PRIMARY KEY USING INDEX TABLESPACE INDX,
name varchar2(10)
);
col segment_name for a15
col TABLESPACE_NAME for a15
select segment_name,tablespace_name from user_segments;
SEGMENT_NAME TABLESPACE_NAME
--------------- ---------------
DATE_LOG TOOLS
CREATE_DATE_PK INDX
基于时间戳表创建一个存储过程
conn snow/snow
CREATE OR REPLACE PROCEDURE create_date_log_row
IS
BEGIN
INSERT INTO date_log VALUES (SYSDATE,'--');
END;
/
创建一个job来执行存储过程,来模拟数据库在“运行中”
每分钟执行一次
conn snow/snow
VARIABLE jobno number;
BEGIN
-- Run the job every 1 minutes
DBMS_JOB.SUBMIT(:jobno, 'snow.create_date_log_row;', SYSDATE, '(SYSDATE + 1/(24*60))');
commit;
END;
/
SNOW@PRACTICE >print jobno
JOBNO
----------
24
SNOW@PRACTICE >col what for a30
SNOW@PRACTICE >SELECT job, what FROM USER_JOBS;
JOB WHAT
---------- ------------------------------
24 snow.create_date_log_row;
更多详情见请继续阅读下一页的精彩内容:
更多详情见请继续阅读下一页的精彩内容:

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
