How To Take Backup Of Database As SQL/TAR File And How Restore Database In PostgreSQL Using pgAdmin4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel i am akram and you are watching knowledge 360. in this video i'll show you how to take back off of whole database as a sql file or tire file that is tape archive file and restore database from those files in postgresql using pc admin so guys let's start from here i have database dvd rental database i have already made a video that how to load a sample database dvd and rental so if you missed that please watch that so see here i have the database i want to take this database with the backup of whole database in a file that is sql file or tar file so i'll show both of the way how to do it so first i'll i will do it in as a sql file so to create a backup in a sql file go to the windows and choose your file location do right click and create a text file first so name it like db script and name it like dot sql okay file extension so to enable file extension you must enable this checkbox check option filename extension just check it and rename it like this so your final file name should be and should be ending with dot sql so this file will be like dot sql file so i have created a file sql file here is the file type that is sql file so now let's go to this and i will select this database as i try and i'm trying to take backup of this database so doing right click click on then select backup now select here the file name browse here if this is not set to sql set it to sql sql or set it to all files then you go to your location here my location is under d drive that sql file if you have saved in any other drive you can go from here so i am doing doing it so select it and check it do it create and you want to replace click on yes now one important thing is click the check the format here for sql just click on plain and here we have dump options so how you want to take backup of your data your database if i i don't want to be logs in and in the backup so i uncheck them and check that option so like this according to your need you can take so for now i am taking backup of only schema as i don't want to take backup of data so i made only schema and i am creating a backup of it so backup job is created started and successfully completed so now in this file that i have created it should have all the uh all that structure created here so these are all the structure that i have taken back off from this so this is the how to take backup in sql file so another way to backtrack backup is to take it from a tar file that is tape archive file so again do right click click on backup and select file name so before selecting file name let's create a file just do right click click let's click name it like dbtar dot tr so this is file extension click on yes this is dara file uh created now go here let's once cancel it and again select this here we are not having that option so do it all files and here is the option db tire click on create for you please click on yes and the format check format tier and then do backup so it will do backup entire file so backup is created now let's go and see this is the tar file and the grid it is created i'm extracting this so this has been created here restore.sql contains all the structures that previously i have taken in dbscript.sql so this is the same as restore.sql nothing different and now all these things 3062.that this is the that file that contains data let me show you one of them so these contain data it is it is always advisable to take backup in an entire file because it won't give you issue while restoring it but in sql file it might give you syntaxes or something like that when you are restoring from a sql script so let's go i have taken backup now i have backup of this database so i will delete drop this database and i will again show you how to restore so i am deleting this the database must have been deleted so for that let's disconnect this once i've disconnected and i'll again reconnect it and now i'll try to drop this database so now the database is deleted again i will show you how to restore it so click on databases do right click create create on database give the name same name you want it to be so this is dvd render and click on save so here is the database that database has been created now if he if we see here there will be no tables and views and nothing here but i'll show you how to restore it so i'll do right click on the database and select the option restore now the file format is there now i'll select the file format that i have taken back up here all files this is this was the file dbta.tar file so i'm selecting it this is this has been selected now restore it it's running and it will be completed soon so this is successfully completed now again refresh it and you will see all the tables and with data it will it will be created there see here everything is created so i will show you how to check if there are data as well or not see here or along with the structure and all the data my database has been restored so in this way you can take a backup in sql file or in a tire file and also you can restore from there so guys this much for the video if you find the video helpful please like the video and subscribe my channel to get the updates of upcoming videos so thanks for watching video let's meet in the in another video till then take care bye you
Info
Channel: Knowledge 360
Views: 7,302
Rating: undefined out of 5
Keywords: knowledge360, akram sohail project, akram sohail, How To Take Backup Of Database As SQL file, How To Take Backup Of Database As TAR File, How Restore Database In PostgreSQL Using pgAdmin4, sql file, tar file, postgresql backup, postgresql restore, pgadmin4, database backup, import database, how to restore postgresql database, how to take backup of postgresql database, import postgresql database, how to, postgres pg_restore, postgresql database, postgresql database administration
Id: ReVKs04YtDQ
Channel Id: undefined
Length: 8min 41sec (521 seconds)
Published: Thu Jul 16 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.