Recover the database on an external hard drive - database-restore

I have projects on an internal hard drive
After I changed the hard drive. I did not export the databases. How I can recover them?.
thanks in advance

You will need access to your data in the old Hard Drive.
Just check this answer: Restoring MySQL database from physical files
Greetings

Related

How to Backup Postgres Database on AWS and restore locally?

I'm working on trying to setup my local database with some mock data to work with. We have a development AWS account with a postgres database. I would like to create a backup of it, export it to my local computer, and restore to my local postgres database.
I've been trying to find how to do this online, but everything I'm finding is on how to backup to AWS and to restore back to AWS. I tried creating a snapshot and exporting it via S3 - but the snapshot doesn't produce a sql file to restore from like I was expecting.
If anyone can point me in the right direction I would very much appreciate it :)
I am afraid that the only chance you have is pg_dump/pg_restore.
Even if Amazon lets you get your hands on its file system backups, which I doubt, they may be of little use to you, since Amazon runs modified versions of PostgreSQL and you cannot be sure that the physical file format is identical to PostgreSQL.

Get big(250Gb) RDS PostgreSQL db dump into my local machine

My problem is to get big(250Gb) postgres dump on my local machine.
Its on AWS RDS. I tried to dump it to local machine, but it takes too long, kinda 3+ days.
Trying to find a way to dump it into S3 and download from there safely. May be you could suggest more effective way to do that. Will appreciate any kind of help.
Thanks!
As of my knowledge, aws does not provide a way to backup db into s3
you can take a look into this question and answers,
Export huge database from amazon RDS to local mysql
here is one answer
If the data is that big I would suggest copying the RDS snapshot on S3, as explained here.
Link to documentation to copy snapshot to s3
This topic is covered in this StackOverflow thread Exporting a AWS Postgres RDS Table to AWS S3
Another solution would be to spin up an EC2 instance and dump the database to a local EBS volume that is large enough for the following steps. Then chose one of the following:
Compress the DB dump into multiple files and copy to S3 for download. I would use a smart S3 download manager given the size of the database dump.
Export the S3 data using Snowball Export S3 Data. If your Internet connection is not fast enough / reliable enough then Snowball will get you the data.

How to copy postgresql database

I have USB mounted SATA drive with some Postgresql databases on it (hard drive contains installed ArchLinux) and would like to move them to current system. Unfortunately I cannot boot from that drive and dump the SQL files. Can someone tell is it hard to move physical files and directories or some other method how I could migrate those databases.
Maybe there is a way to create a symbolic link for current postgresql to use that hard drive as well?

get database postgresql backup from disk

I want to have my postgresql database on disk (Ubuntu 14.04); how can I set this up and access the data? I have to use ftp to get files; I don't know where to search.
If you want a complete backup of the database via FTP, you'll have to follow the documentation. Basically, first you call pg_start_backup, then you get the data directory, then you call pg_stop_backup, then you get all WAL archives.
You have to run recovery on the backup before you can access it.

Can I just backup postgres's directory while it's running?

I need to back up my database but I don't have enough disk space to dump it. Can I just use duplicity to perform incremental backups on the data directory? Would that corrupt the backup somehow? I don't mind a few of the latest rows missing, but I would like my backup to not be destroyed.
Does anyone know what the case is?
Thanks!
See this page. I believe duplicity uses rsync type mechanism, so you cannot simply grab the directory and go - see the page of that page about rsync. If you need to do a file system level backup, while online, then you'll need some sort of atomicity like snapshots.
Most likely, the backup simply wouldn't work.
Postgres has lots of backup options though, like PITR. I suggest a read through the fine manual.
No, you can't backup the data directory while the database service is running. You could backup the WAL-segments for a point in time recovery when you want to restore. You have to make sure you test your recovery as well, it's a litte more complicated then pgrestore of an ordinary dump.