Questions tagged [database-backups]

database-backups are intended to preserve data by serializing database tables to a text format or exporting them to a binary format

database-backups are useful for archiving, upgrading, replicating, and migrating data

References

1580 questions
418
votes
14 answers

Export and Import all MySQL databases at one time

I want to keep a backup of all my MySQL databases. I have more than 100 MySQL databases. I want to export all of them at the same time and again import all of them into my MySQL server at one time. How can I do that?
NewUser
  • 12,713
  • 39
  • 142
  • 236
149
votes
3 answers

Postgresql - backup database and restore on different owner?

I did backup on database on different server and that has different role than I need, with this command: pg_dump -Fc db_name -f db_name.dump Then I copied backup to another server where I need to restore the database, but there is no such owner…
Andrius
  • 19,658
  • 37
  • 143
  • 243
129
votes
11 answers

How to solve privileges issues when restore PostgreSQL Database

I have dumped a clean, no owner backup for Postgres Database with the command pg_dump sample_database -O -c -U Later, when I restore the database with psql -d sample_database -U app_name However, I encountered several errors which prevents me from…
steveyang
  • 9,178
  • 8
  • 54
  • 80
121
votes
9 answers

How to take MySQL database backup using MySQL Workbench?

How to take database backup using MySQL Workbench? Can we take backup in the following ways- Backup file(.sql) contains both Create Table statements and Insert into Table Statements Backup file(.sql) contains only Create Table Statements, not…
Viraj Dhamal
  • 5,165
  • 10
  • 32
  • 41
89
votes
4 answers

Minimum GRANTs needed by mysqldump for dumping a full schema? (TRIGGERs are missing!!)

I have a MySQL user called dump with the following perms: GRANT USAGE ON *.* TO 'dump'@'%' IDENTIFIED BY ... GRANT SELECT, LOCK TABLES ON `mysql`.* TO 'dump'@'%' GRANT SELECT, LOCK TABLES ON `myschema`.* TO 'dump'@'%' I want to dump all data…
Emilio Nicolás
  • 2,554
  • 5
  • 22
  • 29
76
votes
5 answers

Restoring SQL Server backup to Azure SQL Database

Is there a way to simply take a SQL backup .bak file, and using that as a restore point to generate a new database on Azure SQL Database? The wizard that I see generally recommended in this situation wants to create a custom file to use, but it…
Neo
  • 3,309
  • 7
  • 35
  • 44
72
votes
5 answers

How to import a bak file into SQL Server Express

I have a .bak file, and I want to use this file to recreate the database in a fresh install of SQL Server 2008 Management Studio. Can someone point me in the right direction on how this can be done? I have tried: right click on the Databases…
Ashok
  • 1,868
  • 6
  • 36
  • 70
67
votes
3 answers

sql server restoring back up error

I have backed up a database I had created on an other machine running SQL server 2012 express edition and I wanted to restore it on my machine, which is running the same. I have ticked the checkbox overwriting existing one, and got this…
danarj
  • 1,798
  • 7
  • 26
  • 54
66
votes
2 answers

how to backup a django db

I have a Django application that uses a Postgres database. I need to be able to backup and restore the db, both to ensure no data is lost and to be able to copy data from the production server to the development server during testing. There seem to…
trubliphone
  • 4,132
  • 3
  • 42
  • 66
61
votes
7 answers

postgresql: .pgpass not working

I have created a .pgpass file in my home directory which looks like this localhost:5432:somedb:someuser:somepass I am using a shell script which creates a directory and puts a pg_dump of somedb there : mkdir directory pg_dump somedb >…
Deepankar Bajpeyi
  • 5,661
  • 11
  • 44
  • 64
52
votes
1 answer

pg_dump vs pg_dumpall? which one to use to database backups?

I tried pg_dump and then on a separate machine I tried to import the sql and populate the database, I see CREATE TABLE ERROR: role "prod" does not exist CREATE TABLE ERROR: role "prod" does not exist CREATE TABLE ERROR: role "prod" does not…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
49
votes
4 answers

Override file while backup database

I want to back up a database using this code sqlcmd -S servername -Q "BACKUP DATABASE [DBName] TO DISK = 'C:\backup.bak'" It works. But if the backup file already exists, the data gets appended to the file instead of replacing the file. Every time…
juergen d
  • 201,996
  • 37
  • 293
  • 362
48
votes
9 answers

pg_dump: too many command line arguments

what is wrong with this command: pg_dump -U postgres -W admin --disable-triggers -a -t employees -f D:\ddd.txt postgres This is giving error of too many command-line arguments
Bhargav Gor
  • 521
  • 2
  • 6
  • 7
43
votes
5 answers

Is copying the /var/lib/mysql directory a good alternative to mysqldump?

Since I'm making a full backup of my entire debian system, I was thinking if having a copy of /var/lib/mysql directory is a viable alternative to dumping tables with mysqldump. are all informations needed contained in that directory? can single…
Matteo Riva
  • 24,728
  • 12
  • 72
  • 104
36
votes
2 answers

Postgresql: backup all table structures but only a few data table

I have a database with some tables for the application settings, lists like users, departments, cities. I want the structure and the data for those tables. So if i get a new user the backup will save it. But also have some data for historic and…
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118
1
2 3
99 100