[Call Sqlplus.txt in 20170617]vim

Source: Internet
Author: User
Tags dname sqlplus

[Call Sqlplus.txt in 20170617]vim

--//previously wrote an Emacs downgrade with Sqlplus article, has been wanted to learn Emacs, limited own vim, to learn it no interest, the original link is as follows:
--//http://blog.itpub.net/267265/viewspace-1309032/

--//actually VIM also has plug-in connection database, I feel not good, has not been so used.

--//today when it comes to setting up vim-related settings, I find myself defining some ways to share them myself:

Noremap <leader>q1 yp!! Sqlplus-s Scott/[email protected]<cr>
Noremap &LT;LEADER&GT;Q2 yp!! Sqlplus-s Sys/[email protected] as sysdba<cr>
Vnoremap, Q1 "Ay<esc>gv!sqlplus-s scott/[email protected]<cr>
Vnoremap; Q2 "by<esc>gv!sqlplus-s Sys/[email protected] as sysdba<cr>

--//the above information in the Vim configuration file, pay attention to the command must be correct, followed by a semicolon. Of course, the error is not carried out.
--//Modify the database connection string as well as the user, password information according to their needs. Of course there are security issues. ^_^.

SELECT * FROM dept;
--//move to which line, enter \Q1

DEPTNO dname LOC
---------- -------------- -------------
Ten ACCOUNTING NEW YORK
DALLAS
SALES CHICAGO
OPERATIONS DALLAS

@ Checkpoint
--//enters Q2

REDO:


Checkpoint Queue
Checkpoint queue on disk RBA checkpoint queue
Number of dirty blocks timestamp current time on disk RBA SCN checkpoint heartbeat
CPDRT Low_rba on_disk_rba cpodt sysdate diff_date cpods CPHBT CURRENT_SCN DIFF_SCN INDX
------------ -------------------- -------------------- ------------------- ------------------- ---------- ----------- ----- ------------ ------------ ------------ ------------
32 1470.13787.0 1470.13971.0 2017-06-17 22:08:11 2017-06-17 22:08:28 17.00 25428734 946961 434 25428740 6 0


REDO (hexadecimal):

Checkpoint Queue
Checkpoint queue on disk RBA checkpoint queue
Number of dirty blocks timestamp current time on disk RBA SCN checkpoint heartbeat
CPDRT low_rba16 on_disk_rba16 cpodt sysdate diff_date cpods CPHBT CURRENT_SCN DIFF_SCN INDX
------------ -------------------- -------------------- ------------------- ------------------- ---------- ----------- ----- ------------ ------------ ------------ ------------
0x5be.35db.0 0x5be.3693.0 2017-06-17 22:08:11 2017-06-17 22:08:28 17.00 25428734 946961 434 25428741 7 0


Full CHECKPOINT:

Rtckp_rba rtckp_scn current_scn diff_scn rtckp_tim sysdate diff_date
-------------------- ---------------- ------------ ------------ ------------------- ------------------- ----------
1470.2.16 25426654 25428742 2088 2017-06-17 21:39:53 2017-06-17 22:08:28 1715.00


V$instance_recovery:

inst_id actual_redo_blks target_redo_blks 90%_blks timeout_blks target_mttr estimated_mttr
------------ ---------------- ---------------- ------------ ------------ ------------ --------------
1 183 30962 165888 30962 0 63


--//The disadvantage of this approach is that SQL statements must be written in one line.
--//can also do this by pressing V or V, selecting the text, entering v mode, and then breaking in; Q1.
--//a reminder, if you use the shift+ arrow key to select Enter is "select Mode", press CTRL+G to switch to "visual mode"

Select
*
From
Dept

--//, the disadvantage is that the incoming SQL statement disappears. You can copy 2 copies and then execute them.

DEPTNO dname LOC
---------- -------------- -------------
Ten ACCOUNTING NEW YORK
DALLAS
SALES CHICAGO
OPERATIONS DALLAS

--//In addition I put the content in the register a, B, you can use "AP," BP out.

--//caution Note that the statement executed is not a DML statement, such as a insert,update,delete statement, or a TRUNCATE statement. Because the default is to exit is commit. There is a certain risk.
--//It is not generally a problem to execute a SELECT statement. As a test study you should also avoid DML statements, otherwise it would be troublesome to bring this habit to the production depot.
--//Add 1 points, you can also properly set a large point of linesize, so as to avoid the folding line imagination. There are also fatal drawbacks, and each execution opens a connection to the shutdown database. And the connection string is written dead.

--//attached Checkpoint.sql Script
$ cat Checkpoint.sql
Column Low_rba format A20
Column LOW_RBA16 format A20
Column On_disk_rba format A20
Column ON_DISK_RBA16 format A20
Column Rtckp_rba format A20
Column diff_date format 999999.99
Column CPOSD_ONO_DISK_RBA_SCN format 99999999999999999999999999999999
Column CPDRT heading "Checkpoint Queue | Dirty Block Quantity | CPDRT "
Column Cpodt_on_disk_rba heading "Checkpoint Queue |on disk rba| time Stamp | Cpodt "
Column Cpods heading "Checkpoint queue |on disk RBA scn| Cpods "
Column CPHBT heading "Checkpoint Heartbeat | CPHBT "
Column Current_sysdate heading "Current Time | Sysdate "
Set num 12
PROMPT
PROMPT REDO:
PROMPT
SELECT CPDRT,
Cplrba_seq | | '. ' | | Cplrba_bno | | '. ' | | Cplrba_bof "Low_rba",
Cpodr_seq | | '. ' | | Cpodr_bno | | '. ' | | Cpodr_bof "On_disk_rba",
To_date (Cpodt, ' mm-dd-yyyy HH24:MI:SS ') Cpodt_on_disk_rba,
Sysdate Current_sysdate,
ROUND ((Sysdate-to_date (Cpodt, ' mm-dd-yyyy HH24:MI:SS ')) * 86400,
2)
Diff_date,
Cpods,
CPHBT,
CURRENT_SCN,
Current_scn-cpods DIFF_SCN,
Indx
From X$KCCCP, v$database
WHERE cplrba_seq <> 0;

PROMPT
PROMPT REDO (hexadecimal):
PROMPT

SELECT CPDRT,
' 0x ' | | To_char (cplrba_seq, ' fmxxxxxxxx ') | | '. ' | | To_char (cplrba_bno, ' fmxxxxxxxx ') | | '. ' | | To_char (Cplrba_bof, ' fmxxxx ') "Low_rba16",
' 0x ' | | To_char (cpodr_seq, ' fmxxxxxxxx ') | | '. ' | | To_char (cpodr_bno, ' fmxxxxxxxx ') | | '. ' | | To_char (Cpodr_bof, ' fmxxxx ') "On_disk_rba16",
To_date (Cpodt, ' mm-dd-yyyy HH24:MI:SS ') Cpodt_on_disk_rba,
Sysdate Current_sysdate,
ROUND ((Sysdate-to_date (Cpodt, ' mm-dd-yyyy HH24:MI:SS ')) * 86400,
2)
Diff_date,
Cpods,
CPHBT,
CURRENT_SCN,
Current_scn-cpods DIFF_SCN,
Indx
From X$KCCCP, v$database
WHERE cplrba_seq <> 0;

PROMPT
PROMPT Full CHECKPOINT:
PROMPT
SELECT Rtckp_rba_seq | | '. ' | | Rtckp_rba_bno | | '. ' | | Rtckp_rba_bof
"Rtckp_rba",
RTCKP_SCN,
CURRENT_SCN,
CURRENT_SCN-RTCKP_SCN DIFF_SCN,
To_date (Rtckp_tim, ' mm-dd-yyyy HH24:MI:SS ') Rtckp_tim,
Sysdate,
ROUND (
(Sysdate-to_date (Rtckp_tim, ' mm-dd-yyyy HH24:MI:SS ')) * 86400,
2) Diff_date
From X$kccrt, v$database;


PROMPT
PROMPT V$instance_recovery:
PROMPT
SELECT inst_id,
Actual_redo_blks,
Target_redo_blks,
Log_file_size_redo_blks as "90%_blks",
Log_chkpt_timeout_redo_blks as Timeout_blks,
Target_mttr,
Estimated_mttr
From Gv$instance_recovery;

[Call Sqlplus.txt in 20170617]vim

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.