Skip to content

Instantly share code, notes, and snippets.

@liuanyou
Last active May 8, 2020 05:24
Show Gist options
  • Save liuanyou/631c9458b614a6b119bb1112a784ffba to your computer and use it in GitHub Desktop.
Save liuanyou/631c9458b614a6b119bb1112a784ffba to your computer and use it in GitHub Desktop.
Oracle XE - change SID
  1. Install Oracle Database 11g Express Edition

  2. Run Command Line window as administrator, type

    sqlplus sys/ as sysdba

  3. Type

    show parameter spfile;

  4. Type

    shutdown immediate;

  5. Type

    startup mount;

    and

    exit

  6. Type

    nid target=sys/@XE dbname=<db_name>

    It will prompt question and then type

    Y

  7. Type

    set ORACLE_SID=XE

  8. Type

    sqlplus /nolog

  9. Type

    conn sys/ as sysdba

  10. Type

    shutdown immediate;

  11. Type

    startup mount;

  12. Type

    alter system set db_name=<db_name> scope=spfile;

  13. Type

    shutdown immediate;

    and

    exit

  14. Type

    orapwd file=C:\oraclexe\app\oracle\product\11.2.0\server\database\PWD<SID_name>.ora entries=10

    and then type password

  15. Type

    oradim -delete -sid XE

  16. Type

    oradim -new -sid <SID_name> -intpwd -startmode a

  17. Type

    set ORACLE_SID=<SID_name>

  18. Go to Registry Edit to change ORACLE_SID to <SID_name>

  19. Type

    lsnrctl start lsnrctl stop lsnrctl start

  20. Copy initXE.ora to init<SID_name>.ora in folder C:\oraclexe\app\oracle\product\11.2.0\server\database

  21. Type

    sqlplus sys/ as sysdba

  22. Type

    startup mount;

  23. Type

    alter database open resetlogs;

  24. Type

    show parameter db_name;

  25. Type

    select * from v$instance;

    and

    exit

  26. Type

    oradim -edit -sid <SID_name> -startmode auto -srvcstart system

  27. Go to Computer Management, change service 'OracleService<SID_name>' to 'Automatic' startup type, and start the service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment