Tag Info

Hot answers tagged

11

Don't just use the whole table. Instead choose the option to write a query. Then simply write a select statement that doesn't use that Identity Column. Alternatively, when you map columns, if you click "Delete rows in destination table", it will truncate the target table before loading data. If the opportunity exists for data to be removed from the ...


6

You could use Flashback to return the table data back to its original state. Is Flashback enabled? Database needs to be in archive mode: select log_mode from v$database; Should return "ARCHIVEMODE" Check if flashback is enabled: select flashback_on from v$database; Should return "YES" If "NO", you can enable flashback by runing: alter database ...


4

There is only one REMAP_TABLESPACE parameter in de command. It would be seperated with ",". REMAP_TABLESPACE=OLD_SCHEMA_DAT:NEW_SCHEMA_DAT,OLD_SCHEMA_IDX:NEW_SCHEMA_IDX Oracle doc impdp 11.2 http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_import.htm#SUTIL929


3

A DMP file is just a copy of the whole database contents. During the Import, it does not get modified, so you can use that file to "jump back" to the time when that dump file was created as often as you want.


3

The constraints are kept for the renamed table. Drop them before you import the tables with the correct data. alter table t1 drop constraint c; There is also another way to do it if you do not want to lose the wrong data. You can create a new table based on the 2 tables: create table t1 as select * from t; Then you must disable the constraints and ...


2

Below is a SQL Table-Valued Function that I got from Jeff Moden, that will return the File Attributes of a single file: /* Return File Attributes about a single file. WARNING: Uses the sp_OACreate method, which should be SA use only. (Note: much of this is copied from Jeff Moden's routines) TEST: SELECT * FROM pps.fnFileInfo('C:\install.exe') */ ...


2

You would need to use Dynamic SQL to pass a dynamic file path to the Bulk Insert. DECLARE @FileName NVARCHAR(4000); SET @FileName = '/path/to.csv'; DECLARE @sql NVARCHAR(4000) = 'BULK INSERT #CSV FROM ''' + @FileName + ''' WITH ( FIELDTERMINATOR ='','', ROWTERMINATOR =''\n'' )'; EXEC(@sql);


2

Of course you can put it up on Dropbox - or anywhere else. Depends on how secure you want your data to be? Do you want the NSA looking at it? Dropbox employees? I would put up an encrypted version of your mysqldump and securely transmit the key to your colleague - either face to face or over encrypted email, or have the password/key sent by courrier. ...


2

mysqldump, or .sql files, which is what that module uses is probably the least efficient way to import a database (the only less efficient way I can think of is to import and commit each row at once). If you want to speedup the import process, you should change the method. There are several things that you can do in the MySQL configuration that will speed ...


2

I'm assuming based on the post that the PostgreSQL database server and the process restoring the dump are on the same machine. If so: Is it possible to pause the import of the database? Not really. You could SIGSTOP the pg_restore or psql process and/or the corresponding postgres backend, but I wouldn't consider that my first-choice option. If not, ...


2

You wrote 12c db has the exact data of 11g (expdp/impdp) But are you sure? 1) Did you make a consistent export of your tables? This means all table data is from the same point in time. For this it is sufficient that you stop all other write activity on the database during export. Or you set the flashback_scn parameter when using expdp or the ...


1

Technically, you could, but it is incomplete, so better repeat the export after performing the necessary actions to avoid ORA-01555 errors (have an appropriately sized undo tablespace, set undo_retention and retention guarantee).


1

As per documentation your error is: Error: 1261 SQLSTATE: 01000 (ER_WARN_TOO_FEW_RECORDS) Message: Row %ld doesn't contain data for all columns Thus it appears that your table have more column than the file. You will have to specify the column-names explicitly. Also the remaining columns should be nullable. (You might want to share table definition ...


1

You should have him send you a public gpg key that he has the private key for, which you use to encrypt the dump. You can then deliver it to him using any method that is comfortable for you, and then he can decrypt it once he has received it. If you're on Windows.. http://www.gpg4win.org/ is a great tool for that.


1

You can import your .csv file and replace after: Make your date column new_date_column VARCHAR(10). Import the file. UPDATE with REPLACE. UPDATE db1.table1 SET new_date_column = STR_TO_DATE(REPLACE(new_date_column,'/','.'),GET_FORMAT(DATE,'EUR')); Change the datatype of new_date_column. ALTER TABLE db1.table1 MODIFY new_date_column ...


1

When code starts with something like this /*!50100 the code following till */ is executed only, when MySQL is installed in a version above 5.0.100 The error here is, that you're mixing table options with partition options. From the manual: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [table_options] ...


1

You can edit the dump file and change the included NLS_LENGTH_SEMANTICS from BYTE to CHAR. Near the beginning of the file you find a line ending like this : ^@02:00:^@^@^D^@BYTE^F^@UNUSED^A^@2^K^INTERPRETED^K^@DISABLE:ALL^@^@ Change BYTE to CHAR using your favorite text editor and save the file. When you will imp that new dump file, all columns will be ...


1

The documentation page you linked to is for the current version (3.8.9) of SQLite. You could dig up the old version of cli.html for 3.7.13, but at that time, .import was pretty much undocumented.


1

For PostgreSQL, I would recommend using pgloader. pgloader leaves the rows that it cannot import in a separate text file, so you can take a look at what went wrong, fix the errors, and finish importing the data. COPY simply crashed when it encounters a row it didn't expect, which is likely to happen several times for very big files. pgloader can also be ...


1

The general log should never be enabled on a production server (under normal circumstances), as it logs absolutely all queries (reads and writes) performed on the server, taking a lot of disk space and query performance with it. The general log is only useful for debugging issues on the server. You should turn it off on a live server by executing: SET ...


1

All statements that hit the server are stored inside the general log. So general log is duplicating your dump. The general log should be used only for debugging only, and it should be activated for the time required to spot a problem. Try to disactivate general log.


1

In the end I coded a Python function import_csv_to_dynamodb(table_name, csv_file_name, colunm_names, column_types) that imports a CSV into a DynamoDB table. Column names and column must be specified. It uses boto, and takes a lot of inspiration from this gist. Below is the function as well as a demo (main()) and the CSV file used. Tested on Windows 7 x64 ...


1

I would write a python script that would, parse the columns descriptor file, get their widths and names iterate over all the data in the input file, splitting out the data into variables construct a sql query with these variables to the sql server with SQLAlchemy to be sent one by one or as a batch of rows or 1000 at a time This script would take the ...


1

What's below works for your data - be careful of any variation in the field width - that's why delimited files are better - csv, or better still, if you can get it, pipe-delimited (|). It also successfully deals with the header line. I did the following: My code will do for both MD5 and SHA2 passwords - uncomment the relevant bits. CREATE TABLE my_user ( ...


1

Yes, there is a safe way (not faster though) to alter schemas if you use tool. This does not require any downtime. The one we use everyday on our production is to use pt-online-schema-change this tool will show you the progress of the SQL. I hope this helps


1

since you are using TSV file you can use the following command to import the data: LOAD DATA INFILE 'data.tsv' INTO TABLE database_name.my_table; references: http://dev.mysql.com/doc/refman/5.1/en/load-data.html http://forums.devshed.com/mysql-help-4/importing-tab-separated-file-tsv-table-853669.html ...


1

As a solution for someone who can't get pv to work or for whom pv tells lies. You can monitor the size of ibdata1 file in /var/lib/mysql which contains the data. This will end up the same size (or thereabouts) of the filesize in your source server. If there are many tables you can also watch them appear one by one in /var/lib/mysql/< database name>.


1

You can't directly restore a MySQL backup to MSSQL. What you can do is use tools such as Microsoft SQL server migration assistant. But those still won't help you if you don't have the proper permissions on the destination server. You'll most likely be creating a database, editing schemas and creating logins and users. Which means you need the sysadmin ...


1

From BOL: If the database being restored does not exist, the user must have CREATE DATABASE permissions to be able to execute RESTORE. If the database exists, RESTORE permissions default to members of the sysadmin and dbcreator fixed server roles and the owner (dbo) of the database (for the FROM DATABASE_SNAPSHOT option, the database always ...


1

The size needed in a temporary tablespace depends on the data volume manipulated, but including potentially other actions also requiring temporary space. What you should be doing is this : monitor temporary tablespace usage, (temporarily) expand the temporary tablespace. Maybe, you need to recreate your temp tablespace. That is, if there is corruption of ...



Only top voted, non community-wiki answers of a minimum length are eligible