Oracle常用命令总结
-
连接数据库:
sql
sqlplus username/password@hostname:port/SID
-
查看当前用户:
sql
SELECT USER FROM DUAL;
-
查看数据库版本:
sql
SELECT * FROM v$version;
-
创建表:
sql
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
...
);
-
插入数据:
sql
INSERT INTO table_name (column1, column2)
VALUES (value1, value2);
-
查询数据:
sql
SELECT * FROM table_name;
-
更新数据:
sql
UPDATE table_name
SET column1 = value1
WHERE condition;
-
删除数据:
sql
DELETE FROM table_name
WHERE condition;
-
备份数据库:
sql
RMAN> BACKUP DATABASE;
-
恢复数据库:
sql
RMAN> RESTORE DATABASE;