当前位置:网站首页>Common basic Oracle commands
Common basic Oracle commands
2022-06-26 01:29:00 【Mixed with bean curd and】
Oracle Common basic commands
1、 Command line login :sqlplus scott/tiger
sqlplus scott/[email protected]:1521/orcl
2、 Start recording spool d:\ The basic query .txt ( After executing the statement oracle Will be in d Disk create a “ The basic query .txt” file )
End closing the recording screen spool off( If you don't execute this sentence , The basic query .txt It will be an empty file )
3、 Carry out the previous item sql sentence :/
4、 notes :– The comment / The comment /
5、 View the current user :show user;
6、 The table under the current user :select * from tab;
7、 View table structure :desc emp
8、 Clear the screen :Linux:host clear
windows:host cls
9、 View row width :show linesize
10、 Set up :set linesize 120
11、 Set column width : character string :col ename( Name ) for(format)a8(a Representation string ,8 Express 8 Characters );
Numbers :col(column) sal for 9999(9 Represents a number ,4 One means 4 position )
12、 View date formats in the data dictionary :
select * from v$nls_parameters( Data dictionary table );
13、 Change the date format :
alter session|system set NLS_DATE_FORMAT=‘yyyy-mm-dd’;
14、 Set the number of records displayed on one page :
set pagesize 20
15、 View current date time :
mysql:select now();
oracle:select sysdate form dual;
16、count Another way of writing :select count(distinct deptno) from emp;
17、 Format :break on deptno skip 2
Unformatted :break on null
18、sqlplus One for sql The function of statement timing , Open statement :
set timing on(off)
19、 Create a temporary table :create global temporary table ****
20、 Execute the script :@+ File path + file name
@h:\testdelete.sql
21、 Turn off echo messages :set feedback off
22、 There are two ways to delete table records :
delete from Table name where Delete the condition
truncate table
23、 Administrator command line login :sqlplus sys/root as sysdba
24、 The recycle bin
Check the recycle bin :show recyclebin
Empty the recycle bin :purge recyclebin
Delete directly without going through the recycle bin :drop table tableName purge;
flashback drop : Operate the recycle bin :flashback table tableName to before drop
25、 to grant authorization
sys User give scott User permission to create views :grant create view to scott;
sys to scott Inquire about hr Next employees Table authority :grant select on hr.employees to scott;
sys User give scott Permission to create synonyms :grant create synonym to scott;
26、SQL Implementation plan of :
Generate execution plan :explain plan for select * from emp where deptno=10;
Print the execution plan :select * from table(dbms_xplan.display);
Determine which implementation plan is good , see cpu The usage rate of
27、oracle The output switch is off by default
open :set serveroutput on
28、desc + Package : You can view the package structure
desc dbms_output
6
Create user
CREATE USER "username"IDENTIFIED BY “password”;
User created.( The user has created )
4、 Use the following GRANT Statement grants HHZDH User permissions :
SQL> GRANT CONNECT, RESOURCE, DBA TO HHZDH;
Grant succeeded.( Create success )
5、 Log in to the new account to verify whether the user was created successfully
Use HHZDH The user account connects to the database (ORCL). When SQL Plus When prompted for user name and password , Input :HHZDH and 123456.
about Oracle 11g/12c, Use the following command :
SQL> CONNECT [email protected]
eg:connect [email protected]
You can enter commands :select username from dba_users;
View all table usernames
How to modify oracle Table user password
Enter the command :alter user lzfc2 identified by lzfc2;
modify lzfc2 The table user password of is lzfc2
eg:alter user “usename” identified by “newpassword”;
How to modify oracle Table user password
The password was successfully modified after pressing enter
name
Method 1 :
SQL> select name from v$database;
xe
Method 2 :
SQL> select instance_name from v$instance;
INSTANCE_NAME
orcl
Method 3 :
SQL> show parameter instance;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
active_instance_count integer
cluster_database_instances integer 1
instance_groups string
instance_name string XE
instance_number integer 0
instance_type string RDBMS
open_links_per_instance integer 4
parallel_instance_group string
parallel_server_instances integer 1
————————————————
View login user permissions
select * from role_sys_privs;
– see Linux Version information
cat /etc/redhat-release
边栏推荐
猜你喜欢

【花雕体验】11 上手ESP32C3

Discrete Mathematics - 01 mathematical logic

填鸭数据即时收集解决方案资源

STM32GPIO

马斯克 VS 乔布斯,谁是21世纪最伟大的创业家

智慧家——全家具功能

在FreeBSD中安装MySQL数据库

Technical introduction - detailed explanation of chip manufacturing process

ETCD数据库源码分析——集群通信初始化

100ask seven day IOT training camp learning notes - bare metal program framework design
随机推荐
新库上线 | CnOpenData农产品批发价格数据
黑盒测试 — 测试用例 之 判定表法看这一篇就够了
Laravel basic course routing and MVC - controller
**MySQL例题一(根据不同问题,多条件查询)**
Sword finger offer II 096 String interleaving
马斯克 VS 乔布斯,谁是21世纪最伟大的创业家
[excel knowledge and skills] Excel data type
Radio boxes are mutually exclusive and can be deselected at the same time
Duck feeding data instant collection solution resources
Technical introduction - detailed explanation of chip manufacturing process
Freertos+stm32l+esp8266+mqtt protocol transmits temperature and humidity data to Tencent cloud IOT platform
2022年育婴员(五级)考试试题及答案
ASP. Net cache cache usage
毕业季你考虑好去留了吗
Essence and thoughts of 30 lectures on product thinking
Remote incremental synchronization artifact Rsync
FIFO code implemented in C language
返回值为Object型方法调用equals()
Reading notes on how to connect the network - hubs, routers and routers (III)
STM32GPIO