Oracle常用命令总结

  1. 连接数据库:

    sql

    sqlplus username/password@hostname:port/SID

  2. 查看当前用户:

    sql

    SELECT USER FROM DUAL;

  3. 查看数据库版本:

    sql

    SELECT * FROM v$version;

  4. 创建表:

    sql

    CREATE TABLE table_name (

    column1 datatype,

    column2 datatype,

    ...

    );

  5. 插入数据:

    sql

    INSERT INTO table_name (column1, column2)

    VALUES (value1, value2);

  6. 查询数据:

    sql

    SELECT * FROM table_name;

  7. 更新数据:

    sql

    UPDATE table_name

    SET column1 = value1

    WHERE condition;

  8. 删除数据:

    sql

    DELETE FROM table_name

    WHERE condition;

  9. 备份数据库:

    sql

    RMAN> BACKUP DATABASE;

  10. 恢复数据库:

    sql

    RMAN> RESTORE DATABASE;