https://learn.microsoft.com/zh-tw/sql/relational-databases/import-export/import-flat-file-wizard?view=sql-server-ver16
若欄位中有 ,,可以用 ‘’ 來包住
例:
| id | name | no |
|---|---|---|
| 1 | Andy A | '0912345678,0987654321' |
| 2 | Bill B | 01-2345678 |
匯入執行要用 Text qualifier 輸入 ‘’
https://learn.microsoft.com/zh-tw/sql/relational-databases/import-export/import-flat-file-wizard?view=sql-server-ver16
若欄位中有 ,,可以用 ‘’ 來包住
例:
| id | name | no |
|---|---|---|
| 1 | Andy A | '0912345678,0987654321' |
| 2 | Bill B | 01-2345678 |
安全性設定
sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
再下 SQL
opendatasource('SQLOLEDB','Data Source=172.16.2.48;User ID=hcm2db;Password=hcm2db5678').[db1].[dbo].[table1]
完成後再把安全性改回來
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| [oracle@ora1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:02:52 2010Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> archive log listDatabase log mode No Archive ModeAutomatic archival DisabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 25Current log sequence 27SQL> |
USE_DB_RECOVERY_FILE_DEST. You can determine the path by looking at the parameter RECOVERY_FILE_DEST.
1
2
3
4
5
6
7
8
| SQL> show parameter recovery_file_destNAME TYPE VALUE------------------------------------ ----------- ------------------------------db_recovery_file_dest string /u01/app/oracle/flash_recovery _areadb_recovery_file_dest_size big integer 3852MSQL> |
LOG_ARCHIVE_DEST_n to the location in which you wish to write archive logs.
1
2
3
4
5
6
7
8
9
10
11
| SQL> alter system set log_archive_dest_1='LOCATION=/u02/app/oracle/oradata/orcl/arch' scope = both;System altered.SQL> archive log list;Database log mode No Archive ModeAutomatic archival DisabledArchive destination /u02/app/oracle/oradata/orcl/archOldest online log sequence 25Current log sequence 27SQL> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup mountORACLE instance started.Total System Global Area 849530880 bytesFixed Size 1339824 bytesVariable Size 511708752 bytesDatabase Buffers 331350016 bytesRedo Buffers 5132288 bytesDatabase mounted.SQL> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| SQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination /u02/app/oracle/oradata/orcl/archOldest online log sequence 25Next log sequence to archive 27Current log sequence 27SQL> |
1
2
3
4
5
6
7
8
9
10
11
| SQL> alter system switch logfile;System altered.SQL> host [oracle@ora1 ~]$ ls /u02/app/oracle/oradata/orcl/arch1_27_711369564.dbf[oracle@ora1 ~]$ exitexitSQL> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| [oracle@ora1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 8 12:54:05 2010Copyright (c) 1982, 2009, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination /u02/app/oracle/oradata/orcl/archOldest online log sequence 26Next log sequence to archive 28Current log sequence 28SQL> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startup mountORACLE instance started.Total System Global Area 849530880 bytesFixed Size 1339824 bytesVariable Size 511708752 bytesDatabase Buffers 331350016 bytesRedo Buffers 5132288 bytesDatabase mounted.SQL> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| SQL> alter database noarchivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode No Archive ModeAutomatic archival DisabledArchive destination /u02/app/oracle/oradata/orcl/archOldest online log sequence 26Current log sequence 28SQL> |
ARCHIVELOG mode has been disabled.