Delete the database that has been created in the Oracle database and reinstall the new database according to the backup oracle path. The path and database SMID must be exactly the same as the original one.
Stop all Oracle services, go to the oracle installation directory, delete the new database, and copy the backup folder.
Restart the oracle service. At this time, you can use sqlplus to perform related operations on the database. However, when you want to use EM (Enterprise Manager) to manage the database, it will show that "Enterprise Manager cannot connect to the database instance, the following lists the component status information. In this case, EM cannot be used normally. There are many reasons for the problem. You can use emca to reconstruct the database.
Emca re-built database:
Use sqlplus to log on and delete users created on the early DBCONSOLE:
SQL> dropuser sysman cascade;
If it is normal, it will wait for a while and the following error may occur:
========================================================== ========================
ERROR at line 1:
ORA-06553: PLS-801: internal error [56319]
========================================================== ========================
Cause of error: this error occurs when the database is restored to a 32-bit system using a backup disk on a 64-bit system.
Solution: run the script and re-compile the kernel parameters with a 32-bit system.
SQL> shutdown immediate;
SQL> startup upgrade;
SQL> @? /Rdbms/admin/utlirp. SQL
SQL> @? /Rdbms/admin/utlrp. SQL
SQL> shutdown immediate;
SQL> startup;
Where:
Utlirp. SQL is used to compile all relevant content on the 32bit platform.
Utlrp. SQL is used to compile all invalid objects.
And then reconnect again.
Next, rebuild the database.
SQL> droprole MGMT_USER;
SQL> dropuser MGMT_VIEW cascade;
Delete objects created on the early stage DBCONSOLE:
SQL> droppublic synonym MGMT_TARGET_BLACKOUTS;
SQL> droppublic synonym SETEMVIEWUSERCONTEXT;
An error "invalid DBSNMP user name or password" is reported during oem configuration. The reason is that DBSNMP users may be locked, so we first unlock DBSNMP users.
Login: SQL> conn sys/password as sysdba
Unlock: SQL> alter user dbsnmp account unlock;
Submit: SQL> commit;
Change Password: SQL> alter user dbsnmp identified by your new password;
Submit: SQL> commit;
Note: submission is very important, otherwise the unlock will not take effect.
Start to recreate the database and run the following command on the command line:
[Oracle @ localhost ~] Emca-repos recreate
In this case, the following error occurs:
========================================================== ========================
ORA-12526: TNS: listener: all appropriate instances are in restricted mode
========================================================== ========================
OracleORA-12526: TNS: listeners: all applicable routines are in restricted mode.
The reason is that the preceding code is executed when the character set is changed:
[Oracle @ localhost ~] # Alter system enable restrictedsession;
Restricted
Solution: run the following code as a system administrator:
[Oracle @ localhost ~] # Alter system disable restrictedsession;
Run the following command again after the solution is completed:
[Oracle @ localhost ~] # Emca-repos recreate
At this time, you will be prompted to enter relevant parameters and follow the prompts to enter the port number of the listener: 1521. Wait for a short time and then stop the agent after execution:
[Oracle @ localhost ~] # Emctl stop agent
Finally, start rebuilding the database:
[Oracle @ localhost ~] # Emca-config dbcontrol db
At this time, you will also be prompted to enter the relevant parameters. Follow the prompts to enter the corresponding parameters. The listening program port number is still 1521, where the notification email address (optional) and notification sending (SMTP) the server (optional) can be left empty. Press enter directly.
Wait for a short time again. After the execution, the database is successfully rebuilt and Enterprise Manager is started:
[Oracle @ localhost ~] # Emctl start dbconsole
Enter http: // localhost: 1158/em in the address bar of the browser to use Enterprise Manager to manage databases. If other machines cannot be connected, close the firewall.