Oracle database password reset import and export library command example application

  • 2021-12-11 09:28:50
  • OfStack

The reset method is as follows: Open the CMD command prompt and enter the following command to reset:

Enter sqlplus/nolog, Enter

SQL > conn /as sysdba

Connected;

SQL > alter user system identified by "123456"; --(123456 is the reset password)

SQL > alter user sys identified by "123456";

The following is an example of import and export. Looking at the example from import and export can basically be completed, because import and export are very simple.

Data export:

1 Export the database TEST completely, and export the username system password manager to D:\ daochu. dmp
exp system/manager@TEST file=d:\daochu.dmp full=y
2 Export the tables of system users and sys users in the database
exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
3 Export tables table1 and table2 in the database
exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
4 Export the data beginning with "00" in the field filed1 in the table table1 in the database
exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"

The above is commonly used export, I do not care about compression, with winzip dmp file can be very good compression.
But just add compress=y after the above command

Import of data

1 Import the data from D:\ daochu. dmp into the TEST database.
imp system/manager@TEST file=d:\daochu.dmp
There may be a problem with this, because some tables already exist, and then it reports an error, and the table is not imported.
Just add ignore=y after it.
2 Import the table table1 in d:\ daochu.dmp
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)

Basically, the import and export above is enough. In many cases, I delete the table completely and import it.

Data export:

exp hkb/hkb@boss_14 full=y file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbfull.log;

Exporting notes: Exporting is the current user's data, if the current user has DBA permissions, then export all the data!

Data import between users with the same name:
imp hkb/hkb@xe file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbimp.log full=y

Data import between different names:
imp system/test@xe fromuser=hkb touser=hkb_new file=c:\orabackup\hkbfull.dmp

log=c:\orabackup\hkbimp.log;


Related articles: