---
# System prepended metadata

title: Backup/Recovery

---

# Backup/Recovery

### COLD


a)
`sqlplus sys as sysdba`

`select * from v$controlfile;`
`select name from v\$controlfile;`

![](https://i.imgur.com/UoM8dJf.png)


`select name, file#, status, checkpoint_change# “CP“ from v$datafile;`

![](https://i.imgur.com/R3m461o.png)


`checkpoint_change# “CP“ from v$datafile;`
    
b) 
`select name, log_mode from v$database;`

![](https://i.imgur.com/de9GnZW.png)

//alter database noarchivelog;
//alter database open;

`shutdown`

![](https://i.imgur.com/Fz0vBpz.png)

d) 
`cp u01/app/oracle/oradata/XE/users.dbf /tmp/backups`

e)
`startup nomount`

![](https://i.imgur.com/z9ZN9Kt.png)


f)

`CREATE TABLE BackupTest(name VARCHAR(10));`
![](https://i.imgur.com/kH1rTQs.png)


`INSERT INTO BackupTest VALUES('Jojo');`
`INSERT INTO BackupTest VALUES('Peter'); `

![](https://i.imgur.com/BRsn1jQ.png)

g)


Problem:
![](https://i.imgur.com/byQCRDv.png)

![](https://i.imgur.com/NNeO1e6.png)

Habe die Datenank geöffnet um einen User hinzuzufügen.
Nun musste ich neustarten um die Datenbank zu schließen.
![](https://i.imgur.com/dtxTYhX.png)

(`ALTER SYSTEM SWITCH LOGFILE`)


h)

`SHUTDOWN ABORT`

![](https://i.imgur.com/GaLBxiH.png)

i)

`cp /tmp/backups u01/app/oracle/oradata/XE/users.dbf`


j)

![](https://i.imgur.com/CLbxXL8.png)

k)

recover datafile '/u01/app/oracle/oradata/XE/users.dbf'
![](https://i.imgur.com/qbeJjmd.png)


l)
![](https://i.imgur.com/LY3GXs7.png)


### HOT

a)
![](https://i.imgur.com/10WlSaf.png)
Die Datenbank ist scho offen.


b)

![](https://i.imgur.com/olWOR2C.png)

c)

`ALTER SYSTEM SWITCH LOGFILE`
![](https://i.imgur.com/8PQbvmI.png)


Konnte die Datei nicht finden


d)
![](https://i.imgur.com/8R17Plk.png)


e)

![](https://i.imgur.com/M77lZth.png)
![](https://i.imgur.com/YbObUFY.png)

f)
![](https://i.imgur.com/LcY0cpI.png)

g)
![](https://i.imgur.com/1rKfcgZ.png)

h)
![](https://i.imgur.com/hiOO71e.png)
![](https://i.imgur.com/Jdipl1u.png)


i)
![](https://i.imgur.com/MPCINk3.png)

j)
![](https://i.imgur.com/tV9mU6u.png)
![](https://i.imgur.com/sNKGvBZ.png)
![](https://i.imgur.com/8kDbe4q.png)
![](https://i.imgur.com/OzgJ0nQ.png)

![](https://i.imgur.com/cBw6nzw.png)

k)
![](https://i.imgur.com/ZObgP3j.png)
Problem:
![](https://i.imgur.com/PC5epTt.png)

![](https://i.imgur.com/qiyQJxM.png)
Lösung:
 ![](https://i.imgur.com/1JHrgxJ.png)
 
 l)
![](https://i.imgur.com/Gwoovww.png)

 
#### Log von Hot Backup

https://htblaleonding-my.sharepoint.com/:t:/g/personal/l_engleder_htblaleonding_onmicrosoft_com/EdmrN0Q2XQ1OlOAklt9ddSUBRwSk0W-xXuczGJ1Oc6PPDQ?e=EEYebf


