質問編集履歴

4

修正

2020/06/26 03:43

投稿

nao085
nao085

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,9 +1,7 @@
1
- オラクルブロンズの勉強をしようと思い、下記の記事を参考にmac OS でOracle Databaseを使えるように進めました。
1
+ 下記の記事を参考にmac OS でOracle Databaseを使えるように進めました。
2
2
 
3
3
  [https://qiita.com/shinbones/items/07d474a049c454100363](https://qiita.com/shinbones/items/07d474a049c454100363)
4
4
 
5
-
6
-
7
5
  オラクルブロンズ白本付属のサンプル表をOracle Databaseに登録しようとSQL*Plusのプロンプトに@cretab.sqlと入力して、スクリプトファイルを実行したところ下記のエラーが出ました。
8
6
 
9
7
  SQL> @cretab.sql
@@ -12,53 +10,23 @@
12
10
 
13
11
  SP2-0734: unknown command beginning "?@/* SYSTE..." - rest of line ignored.
14
12
 
15
-
16
-
17
13
  "Clean Up ..."
18
14
 
19
15
  "??????s???̓G???[?????????܂?????肠??܂???B"
20
16
 
21
-
22
-
23
17
  User dropped.
24
18
 
25
-
26
-
27
-
28
-
29
19
  "ora01" User Creating...
30
20
 
31
-
32
-
33
- User created.
21
+ User created
34
-
35
-
36
-
37
-
38
-
22
+
39
- Grant succeeded.
23
+ Grant succeeded.
40
-
41
-
42
-
43
-
44
-
24
+
45
- Grant succeeded.
25
+ Grant succeeded.
46
-
47
-
48
-
49
-
50
-
26
+
51
- Grant succeeded.
27
+ Grant succeeded.
52
-
53
-
54
-
55
-
56
-
28
+
57
- Grant succeeded.
29
+ Grant succeeded.
58
-
59
-
60
-
61
-
62
30
 
63
31
  "ora01" 's DATA Creating...
64
32
 
@@ -66,246 +34,214 @@
66
34
 
67
35
  ORA-12545: Connect failed because target host or object does not exist
68
36
 
69
-
70
-
71
-
72
-
73
37
  Warning: You are no longer connected to ORACLE.
74
38
 
75
- SP2-0640: Not connected
76
-
77
- SP2-0640: Not connected
78
-
79
- SP2-0640: Not connected
80
-
81
- SP2-0640: Not connected
82
-
83
- SP2-0640: Not connected
84
-
85
- SP2-0640: Not connected
86
-
87
- SP2-0640: Not connected
88
-
89
- SP2-0640: Not connected
90
-
91
- SP2-0640: Not connected
92
-
93
- SP2-0640: Not connected
94
-
95
- SP2-0640: Not connected
96
-
97
- SP2-0640: Not connected
98
-
99
- SP2-0640: Not connected
100
-
101
- SP2-0640: Not connected
102
-
103
- SP2-0640: Not connected
104
-
105
- SP2-0640: Not connected
106
-
107
- SP2-0640: Not connected
108
-
109
- SP2-0640: Not connected
110
-
111
- SP2-0640: Not connected
112
-
113
- SP2-0640: Not connected
114
-
115
- SP2-0640: Not connected
116
-
117
- SP2-0640: Not connected
118
-
119
- SP2-0640: Not connected
120
-
121
- SP2-0640: Not connected
122
-
123
- SP2-0640: Not connected
124
-
125
- SP2-0640: Not connected
126
-
127
- SP2-0640: Not connected
128
-
129
- SP2-0640: Not connected
130
-
131
- SP2-0640: Not connected
132
-
133
- SP2-0640: Not connected
134
-
135
- SP2-0640: Not connected
136
-
137
- SP2-0640: Not connected
138
-
139
- SP2-0640: Not connected
140
-
141
- SP2-0640: Not connected
142
-
143
- SP2-0640: Not connected
144
-
145
- SP2-0640: Not connected
146
-
147
- SP2-0640: Not connected
148
-
149
- SP2-0640: Not connected
150
-
151
- SP2-0640: Not connected
152
-
153
- SP2-0640: Not connected
154
-
155
- SP2-0640: Not connected
156
-
157
- SP2-0640: Not connected
158
-
159
- SP2-0640: Not connected
160
-
161
- SP2-0640: Not connected
162
-
163
- SP2-0640: Not connected
164
-
165
- SP2-0640: Not connected
166
-
167
- SP2-0640: Not connected
168
-
169
- SP2-0640: Not connected
170
-
171
- SP2-0640: Not connected
172
-
173
- SP2-0640: Not connected
174
-
175
- SP2-0640: Not connected
176
-
177
- SP2-0640: Not connected
178
-
179
- SP2-0640: Not connected
180
-
181
- SP2-0640: Not connected
182
-
183
- SP2-0640: Not connected
184
-
185
- SP2-0640: Not connected
186
-
187
- SP2-0640: Not connected
188
-
189
- SP2-0640: Not connected
190
-
191
- SP2-0640: Not connected
192
-
193
- SP2-0640: Not connected
194
-
195
- SP2-0640: Not connected
196
-
197
- SP2-0640: Not connected
198
-
199
- SP2-0640: Not connected
200
-
201
- SP2-0640: Not connected
202
-
203
- SP2-0640: Not connected
204
-
205
- SP2-0640: Not connected
206
-
207
- SP2-0640: Not connected
208
-
209
- SP2-0640: Not connected
210
-
211
- SP2-0640: Not connected
212
-
213
- SP2-0640: Not connected
214
-
215
- SP2-0640: Not connected
216
-
217
- SP2-0640: Not connected
218
-
219
- SP2-0640: Not connected
220
-
221
- SP2-0640: Not connected
222
-
223
- SP2-0640: Not connected
224
-
225
- SP2-0640: Not connected
226
-
227
- SP2-0640: Not connected
228
-
229
- SP2-0640: Not connected
230
-
231
- SP2-0640: Not connected
232
-
233
- SP2-0640: Not connected
234
-
235
- SP2-0640: Not connected
236
-
237
- SP2-0640: Not connected
238
-
239
- SP2-0640: Not connected
240
-
241
- SP2-0640: Not connected
242
-
243
- SP2-0640: Not connected
244
-
245
- SP2-0640: Not connected
246
-
247
- SP2-0640: Not connected
248
-
249
- SP2-0640: Not connected
250
-
251
- SP2-0640: Not connected
252
-
253
- SP2-0640: Not connected
254
-
255
- SP2-0640: Not connected
256
-
257
- SP2-0640: Not connected
258
-
259
- SP2-0640: Not connected
260
-
261
- SP2-0640: Not connected
262
-
263
- SP2-0640: Not connected
264
-
265
- SP2-0640: Not connected
266
-
267
- SP2-0640: Not connected
268
-
269
- SP2-0640: Not connected
270
-
271
- SP2-0640: Not connected
272
-
273
- SP2-0640: Not connected
274
-
275
- SP2-0640: Not connected
276
-
277
- SP2-0640: Not connected
278
-
279
- SP2-0640: Not connected
280
-
281
- SP2-0640: Not connected
282
-
283
- SP2-0640: Not connected
284
-
285
- SP2-0640: Not connected
286
-
287
- SP2-0640: Not connected
288
-
289
- SP2-0640: Not connected
290
-
291
- SP2-0640: Not connected
292
-
293
- SP2-0640: Not connected
294
-
295
- SP2-0640: Not connected
296
-
297
- SP2-0640: Not connected
298
-
299
- SP2-0640: Not connected
300
-
301
- SP2-0640: Not connected
302
-
303
- SP2-0640: Not connected
304
-
305
- SP2-0640: Not connected
306
-
307
- SP2-0640: Not connected
308
-
309
- SP2-0640: Not connected
310
-
311
- SP2-0640: Not connected
39
+ SP2-0640: Not connectedが以下119行続きます。
40
+
41
+
42
+
43
+ ```sql
44
+
45
+ SPOOL setup.log
46
+
47
+ PROMPT
48
+
49
+ PROMPT "Clean Up ..."
50
+
51
+ PROMPT "初回実行時はエラーが発生しますが問題ありません。"
52
+
53
+ DROP USER ora01 CASCADE;
54
+
55
+ PROMPT
56
+
57
+ PROMPT "ora01" User Creating...
58
+
59
+ CREATE USER ora01
60
+
61
+ IDENTIFIED BY oracle;
62
+
63
+ GRANT CONNECT,RESOURCE,UNLIMITED TABLESPACE TO ora01;
64
+
65
+ GRANT CREATE SYNONYM TO ora01;
66
+
67
+ GRANT CREATE ROLE TO ora01;
68
+
69
+ GRANT CREATE VIEW TO ora01;
70
+
71
+ PROMPT
72
+
73
+ PROMPT "ora01" 's DATA Creating...
74
+
75
+ CONNECT ora01/oracle
76
+
77
+ CREATE TABLE departments
78
+
79
+ (deptno NUMBER(2) CONSTRAINT pk_dept PRIMARY KEY,
80
+
81
+ dname VARCHAR2(14) ,
82
+
83
+ loc VARCHAR2(10) ) ;
84
+
85
+ CREATE TABLE employees
86
+
87
+ (empno NUMBER(4) CONSTRAINT pk_emp PRIMARY KEY,
88
+
89
+ ename VARCHAR2(10),
90
+
91
+ yomi VARCHAR2(20),
92
+
93
+ job VARCHAR2(8),
94
+
95
+ mgr NUMBER(4),
96
+
97
+ hiredate DATE,
98
+
99
+ sal NUMBER(7),
100
+
101
+ comm NUMBER(7),
102
+
103
+ deptno NUMBER(2) CONSTRAINT fk_deptno REFERENCES departments(deptno));
104
+
105
+ INSERT INTO departments VALUES
106
+
107
+ (10,'管理','大手町');
108
+
109
+ INSERT INTO departments VALUES
110
+
111
+ (20,'研究開発','横浜');
112
+
113
+ INSERT INTO departments VALUES
114
+
115
+ (30,'営業','品川');
116
+
117
+ INSERT INTO departments VALUES
118
+
119
+ (40,'財務','東京');
120
+
121
+ INSERT INTO employees VALUES
122
+
123
+ (1001,'佐藤','sato','社長',NULL,to_date('2001-02-25','yyyy-mm-dd'),500000,NULL,10);
124
+
125
+ INSERT INTO employees VALUES
126
+
127
+ (1002,'鈴木','suzuki','事務',1013,to_date('2000-03-26','yyyy-mm-dd'),200000,NULL,20);
128
+
129
+ INSERT INTO employees VALUES
130
+
131
+ (1003,'高橋','takahashi','営業',1007,to_date('2000-05-30 ','yyyy-mm-dd'),300000,30000,30);
132
+
133
+ INSERT INTO employees VALUES
134
+
135
+ (1004,'田中','tanaka','営業',1007,to_date('2002-06-02','yyyy-mm-dd'),355000,50000,30);
136
+
137
+ INSERT INTO employees VALUES
138
+
139
+ (1005,'渡辺','watanabe','部長',1001,to_date('2002-07-11','yyyy-mm-dd'),280000,NULL,20);
140
+
141
+ CREATE TABLE salgrades
142
+
143
+ ( grade CHAR(1) CONSTRAINT pk_grade PRIMARY KEY,
144
+
145
+ losal NUMBER(7),
146
+
147
+ hisal NUMBER(7));
148
+
149
+ INSERT INTO salgrades VALUES ('A',100000,190000);
150
+
151
+ INSERT INTO salgrades VALUES ('B',190001,280000);
152
+
153
+ INSERT INTO salgrades VALUES ('C',280001,370000);
154
+
155
+ INSERT INTO salgrades VALUES ('D',370001,460000);
156
+
157
+ INSERT INTO salgrades VALUES ('E',460001,999999);
158
+
159
+ CREATE TABLE customers
160
+
161
+ (custno NUMBER(5) CONSTRAINT cust_pk PRIMARY KEY,
162
+
163
+ cname VARCHAR2(20),
164
+
165
+ address VARCHAR2(30),
166
+
167
+ phone VARCHAR2(12),
168
+
169
+ credit_rating VARCHAR2(6));
170
+
171
+ INSERT INTO customers VALUES (1000,'品川商事','東京都港区1-x-x','03-1234-xxxx','優良');
172
+
173
+ INSERT INTO customers VALUES (1001,'横浜商店','横浜市磯子区2-x-x','045-753-xxxx','要注意');
174
+
175
+ INSERT INTO customers VALUES (1002,'川口や','川口市本町1-x-xx','048-336-xxxx','要注意');
176
+
177
+ INSERT INTO customers VALUES (1003,'○×商店','横浜市鶴見区2-xx','045-505-xxxx','良');
178
+
179
+ INSERT INTO customers VALUES (1004,'川崎ストア','川崎市川崎区10-xx','044-567-xxxx','優良');
180
+
181
+ CREATE TABLE products
182
+
183
+ (PRODNO CHAR(3) CONSTRAINT PROD_PK PRIMARY KEY,
184
+
185
+ PNAME VARCHAR2(30),
186
+
187
+ PRICE NUMBER(6));
188
+
189
+ INSERT INTO products VALUES ('A01','100円ボールペン',100);
190
+
191
+ INSERT INTO products VALUES ('A02','芯強シャープペンシル',100);
192
+
193
+ INSERT INTO products VALUES ('A03','10色ボールペン',300);
194
+
195
+ INSERT INTO products VALUES ('A04','最高級万年筆',1000);
196
+
197
+ INSERT INTO products VALUES ('A05','なないろ鉛筆',30);
198
+
199
+ REATE TABLE orders
200
+
201
+ (ordno NUMBER(8) CONSTRAINT ORD_PK PRIMARY KEY,
202
+
203
+ custno NUMBER(5) CONSTRAINT ORD_CUST_FK REFERENCES customers(CUSTNO),
204
+
205
+ date_ordered DATE,
206
+
207
+ date_shipped DATE,
208
+
209
+ salesman_no NUMBER(4) CONSTRAINT ord_emp_fk REFERENCES employees(empno),
210
+
211
+ payment_type VARCHAR2(10));
212
+
213
+ INSERT INTO orders VALUES (1,1001,'2009-12-20','2009-12-27',1003,'クレジット');
214
+
215
+ INSERT INTO orders VALUES (2,1001,'2009-12-21','2009-12-27',1003,'クレジット');
216
+
217
+ INSERT INTO orders VALUES (3,1001,'2010-01-10','2010-01-17',1003,'クレジット');
218
+
219
+ INSERT INTO orders VALUES (4,1002,'2010-01-11','2010-01-18',1010,'クレジット');
220
+
221
+ INSERT INTO orders VALUES (5,1008,'2010-01-15','2010-01-22',1003,'クレジット');
222
+
223
+ CREATE TABLE ord_details
224
+
225
+ (ordno NUMBER(8) CONSTRAINT ord_det_ord_fk REFERENCES orders(ordno),
226
+
227
+ prodno CHAR(3) CONSTRAINT ord_det_prod_fk REFERENCES products(prodno),
228
+
229
+ quantity NUMBER(5),
230
+
231
+ CONSTRAINT ord_det_pk PRIMARY KEY(ordno,prodno));
232
+
233
+ INSERT INTO ord_details VALUES (1,'A02',30);
234
+
235
+ INSERT INTO ord_details VALUES (1,'C01',20);
236
+
237
+ INSERT INTO ord_details VALUES (2,'B01',5);
238
+
239
+ INSERT INTO ord_details VALUES (2,'B06',10);
240
+
241
+ INSERT INTO ord_details VALUES (2,'B02',10);
242
+
243
+ SPOOL off
244
+
245
+ ```
246
+
247
+ 文字化けしているのをediterで開きUTF-8からShift JISへエンコードを変更しました。

3

イメージの削除、エラーメッセージの添付

2020/06/26 03:43

投稿

nao085
nao085

スコア2

test CHANGED
File without changes
test CHANGED
@@ -6,8 +6,306 @@
6
6
 
7
7
  オラクルブロンズ白本付属のサンプル表をOracle Databaseに登録しようとSQL*Plusのプロンプトに@cretab.sqlと入力して、スクリプトファイルを実行したところ下記のエラーが出ました。
8
8
 
9
+ SQL> @cretab.sql
10
+
11
+ SP2-0734: unknown command beginning "?@ /* ???K..." - rest of line ignored.
12
+
13
+ SP2-0734: unknown command beginning "?@/* SYSTE..." - rest of line ignored.
14
+
15
+
16
+
17
+ "Clean Up ..."
18
+
19
+ "??????s???̓G???[?????????܂?????肠??܂???B"
20
+
21
+
22
+
23
+ User dropped.
24
+
25
+
26
+
27
+
28
+
29
+ "ora01" User Creating...
30
+
31
+
32
+
33
+ User created.
34
+
35
+
36
+
37
+
38
+
39
+ Grant succeeded.
40
+
41
+
42
+
43
+
44
+
45
+ Grant succeeded.
46
+
47
+
48
+
49
+
50
+
51
+ Grant succeeded.
52
+
53
+
54
+
55
+
56
+
57
+ Grant succeeded.
58
+
59
+
60
+
61
+
62
+
9
- ![イメージ説明](9a2db8eb7d197ead7d0106fda4f6fa15.png)
63
+ "ora01" 's DATA Creating...
64
+
10
-
65
+ ERROR:
11
-
12
-
66
+
13
- ORACLE_SIDの環境変数が間違っているのだろうかと考え設定してみましたが、解決することはできませんでした。
67
+ ORA-12545: Connect failed because target host or object does not exist
68
+
69
+
70
+
71
+
72
+
73
+ Warning: You are no longer connected to ORACLE.
74
+
75
+ SP2-0640: Not connected
76
+
77
+ SP2-0640: Not connected
78
+
79
+ SP2-0640: Not connected
80
+
81
+ SP2-0640: Not connected
82
+
83
+ SP2-0640: Not connected
84
+
85
+ SP2-0640: Not connected
86
+
87
+ SP2-0640: Not connected
88
+
89
+ SP2-0640: Not connected
90
+
91
+ SP2-0640: Not connected
92
+
93
+ SP2-0640: Not connected
94
+
95
+ SP2-0640: Not connected
96
+
97
+ SP2-0640: Not connected
98
+
99
+ SP2-0640: Not connected
100
+
101
+ SP2-0640: Not connected
102
+
103
+ SP2-0640: Not connected
104
+
105
+ SP2-0640: Not connected
106
+
107
+ SP2-0640: Not connected
108
+
109
+ SP2-0640: Not connected
110
+
111
+ SP2-0640: Not connected
112
+
113
+ SP2-0640: Not connected
114
+
115
+ SP2-0640: Not connected
116
+
117
+ SP2-0640: Not connected
118
+
119
+ SP2-0640: Not connected
120
+
121
+ SP2-0640: Not connected
122
+
123
+ SP2-0640: Not connected
124
+
125
+ SP2-0640: Not connected
126
+
127
+ SP2-0640: Not connected
128
+
129
+ SP2-0640: Not connected
130
+
131
+ SP2-0640: Not connected
132
+
133
+ SP2-0640: Not connected
134
+
135
+ SP2-0640: Not connected
136
+
137
+ SP2-0640: Not connected
138
+
139
+ SP2-0640: Not connected
140
+
141
+ SP2-0640: Not connected
142
+
143
+ SP2-0640: Not connected
144
+
145
+ SP2-0640: Not connected
146
+
147
+ SP2-0640: Not connected
148
+
149
+ SP2-0640: Not connected
150
+
151
+ SP2-0640: Not connected
152
+
153
+ SP2-0640: Not connected
154
+
155
+ SP2-0640: Not connected
156
+
157
+ SP2-0640: Not connected
158
+
159
+ SP2-0640: Not connected
160
+
161
+ SP2-0640: Not connected
162
+
163
+ SP2-0640: Not connected
164
+
165
+ SP2-0640: Not connected
166
+
167
+ SP2-0640: Not connected
168
+
169
+ SP2-0640: Not connected
170
+
171
+ SP2-0640: Not connected
172
+
173
+ SP2-0640: Not connected
174
+
175
+ SP2-0640: Not connected
176
+
177
+ SP2-0640: Not connected
178
+
179
+ SP2-0640: Not connected
180
+
181
+ SP2-0640: Not connected
182
+
183
+ SP2-0640: Not connected
184
+
185
+ SP2-0640: Not connected
186
+
187
+ SP2-0640: Not connected
188
+
189
+ SP2-0640: Not connected
190
+
191
+ SP2-0640: Not connected
192
+
193
+ SP2-0640: Not connected
194
+
195
+ SP2-0640: Not connected
196
+
197
+ SP2-0640: Not connected
198
+
199
+ SP2-0640: Not connected
200
+
201
+ SP2-0640: Not connected
202
+
203
+ SP2-0640: Not connected
204
+
205
+ SP2-0640: Not connected
206
+
207
+ SP2-0640: Not connected
208
+
209
+ SP2-0640: Not connected
210
+
211
+ SP2-0640: Not connected
212
+
213
+ SP2-0640: Not connected
214
+
215
+ SP2-0640: Not connected
216
+
217
+ SP2-0640: Not connected
218
+
219
+ SP2-0640: Not connected
220
+
221
+ SP2-0640: Not connected
222
+
223
+ SP2-0640: Not connected
224
+
225
+ SP2-0640: Not connected
226
+
227
+ SP2-0640: Not connected
228
+
229
+ SP2-0640: Not connected
230
+
231
+ SP2-0640: Not connected
232
+
233
+ SP2-0640: Not connected
234
+
235
+ SP2-0640: Not connected
236
+
237
+ SP2-0640: Not connected
238
+
239
+ SP2-0640: Not connected
240
+
241
+ SP2-0640: Not connected
242
+
243
+ SP2-0640: Not connected
244
+
245
+ SP2-0640: Not connected
246
+
247
+ SP2-0640: Not connected
248
+
249
+ SP2-0640: Not connected
250
+
251
+ SP2-0640: Not connected
252
+
253
+ SP2-0640: Not connected
254
+
255
+ SP2-0640: Not connected
256
+
257
+ SP2-0640: Not connected
258
+
259
+ SP2-0640: Not connected
260
+
261
+ SP2-0640: Not connected
262
+
263
+ SP2-0640: Not connected
264
+
265
+ SP2-0640: Not connected
266
+
267
+ SP2-0640: Not connected
268
+
269
+ SP2-0640: Not connected
270
+
271
+ SP2-0640: Not connected
272
+
273
+ SP2-0640: Not connected
274
+
275
+ SP2-0640: Not connected
276
+
277
+ SP2-0640: Not connected
278
+
279
+ SP2-0640: Not connected
280
+
281
+ SP2-0640: Not connected
282
+
283
+ SP2-0640: Not connected
284
+
285
+ SP2-0640: Not connected
286
+
287
+ SP2-0640: Not connected
288
+
289
+ SP2-0640: Not connected
290
+
291
+ SP2-0640: Not connected
292
+
293
+ SP2-0640: Not connected
294
+
295
+ SP2-0640: Not connected
296
+
297
+ SP2-0640: Not connected
298
+
299
+ SP2-0640: Not connected
300
+
301
+ SP2-0640: Not connected
302
+
303
+ SP2-0640: Not connected
304
+
305
+ SP2-0640: Not connected
306
+
307
+ SP2-0640: Not connected
308
+
309
+ SP2-0640: Not connected
310
+
311
+ SP2-0640: Not connected

2

参考記事リンク化

2020/06/25 11:21

投稿

nao085
nao085

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
1
  オラクルブロンズの勉強をしようと思い、下記の記事を参考にmac OS でOracle Databaseを使えるように進めました。
2
2
 
3
- https://qiita.com/shinbones/items/07d474a049c454100363
3
+ [https://qiita.com/shinbones/items/07d474a049c454100363](https://qiita.com/shinbones/items/07d474a049c454100363)
4
4
 
5
5
 
6
6
 

1

画像の挿入

2020/06/25 10:24

投稿

nao085
nao085

スコア2

test CHANGED
File without changes
test CHANGED
@@ -6,9 +6,7 @@
6
6
 
7
7
  オラクルブロンズ白本付属のサンプル表をOracle Databaseに登録しようとSQL*Plusのプロンプトに@cretab.sqlと入力して、スクリプトファイルを実行したところ下記のエラーが出ました。
8
8
 
9
-
10
-
11
- [![Image from Gyazo](https://i.gyazo.com/417af31c5fae97fd6929af3330c517ff.png)](https://gyazo.com/417af31c5fae97fd6929af3330c517ff)
9
+ ![イメージ説明](9a2db8eb7d197ead7d0106fda4f6fa15.png)
12
10
 
13
11
 
14
12