Connect to Oracle database and perform a series of operations under Linux

Operate Oracle database under Linux

To operate Oracle, ensure that the Oracle database has been installed on the server
1. Connect to the server with the Oracle database
ssh 172.16.100.201 (server IP) as shown in the figure

2. According to the prompt, enter the root password of the server, and you can connect if the input is correct.

Switch to Oracle database

su - oracle

3. After the switch is successful, the Oracle user will be displayed, such as: [oracle@cicro201 ~]$

4. Switch to sqlplus operation

sqlplus /nolog;


The status after the switch is successful is shown in the figure above~

5. Connect to the database

conn xx/xx;(用户名/密码)

6. If Connected is displayed, the connection is successful.

7. Then you can write sql statement

查询
select * from xx;(表名,记住一定要加;号)
增加
insertt into xx(表名) values ...;
commit;(一定要加commit,事物提交)
删除
delete from xx(表名) where id=1;
commit;
修改
update xx set name="zhangsan";
commit;

8. Exit

quit;

If it shows Disconnected, it will exit the sql state~

Guess you like

Origin blog.csdn.net/zhaoguofeng996/article/details/129282539