At work, there are often no third-party SQL tools such as sqplus developer, which must be directly queried on the server using sqlplus.
For example, to view the SGA value of the system parameter;
The execution result is as follows:
- [Gysy01 @ Oracle]/Oracle> sqlplus "/
Sysdba"
- SQL * Plus: Release 11.1.0.7.0-production on Thursday
February 17 17:35:16 2011
- Copyright (c) 1982,200 8, Oracle. All rights
Reserved.
- Connected:
- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0-64bit
Production
- With the partitioning, real Application Clusters, OLAP, Data Mining
- And real application testing options
- SQL> show parameter SGA;
- Name type
- ----------------------------------------------------------
- Value
- ------------------------------
- Lock_sga Boolean
- False
- Pre_page_sga Boolean
- False
- Sga_max_size big integer
- 4G
- Sga_target big integer
- 3G
- SQL>
We can see that the serial problem is very serious. In this case, you need to set the number of line characters. The following figure shows the Parameter Modification result.
- SQL> set linesize 1000
- SQL> show parameter SGA;
- Name type value
- ----------------------------------------------------------------------------------------
- Lock_sga Boolean false
- Pre_page_sga Boolean false
- Sga_max_size big integer 4G
- Sga_target big integer 3G
- SQL>
Below are some common parameter descriptions, which use linesize, pagesize, and rowwidth parameters.
SQL> set colsep ''; //-domain output Separator
SQL> set echo off; // displays each SQL command in the Start script. The default value is on.
SQL> set echo on // set whether to display the statement when running the command
SQL> set feedback on; // The "XX rows selected" is displayed"
SQL> set feedback off; // display the number of records processed by this SQL command. The default value is on.
SQL> set heading off; // output domain title, on by default
SQL> set pagesize 0; // number of output lines per page. The default value is 24. To avoid paging, you can set the value to 0.
SQL> set linesize 80; // output the number of characters in a row. The default value is 80.
SQL> set numwidth 12; // The length of the output number field. The default value is 10.
SQL> set termout off; // displays the execution results of commands in the script. The default value is on.
SQL> set trimout on; // Remove trailing spaces in each row of the standard output. The default value is off.
SQL> set trimspool on; // remove the trailing space of each row from the redirection (Spool) output. The default value is off.
SQL> set serveroutput on; // set to allow display of output similar to dbms_output
SQL> set timing on; // set to display "time in use: XXXX"
SQL> set autotrace on-; // set to allow analysis of executed SQL statements
Set verify off // you can close or open the prompt to confirm the display of information old 1 and new 1.
Export result to text:
Spool <spool_flat_file>
Example: spool D: \ spool_flatquery.txt
In this way, SQL * Plus will specify all output and on-screen commands to this file.
Execute the query output. At this time, the system does not save the result to the file, but saves it to the buffer.
After the query is complete, close the file. Command Format: spool off.