将设为首页浏览此站
开启辅助访问 天气与日历 收藏本站联系我们切换到窄版

易陆发现论坛

 找回密码
 开始注册
查看: 150|回复: 1
收起左侧

数据查询删除snapshots数据库命令和步骤

[复制链接]
发表于 2021-5-19 15:49:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?开始注册

x
MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '71146765-659d-47c9-9682-5e077461f6ba';
- d/ V$ k( @3 {: j2 X" S+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
8 a+ F  f" K, o8 m7 D" F| id                                   | volume_id                            | user_id                          | status    | display_name |, W6 r' n4 ~$ O1 M2 h* j2 r
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
8 G1 w) r* s6 x; U9 R( N| 71146765-659d-47c9-9682-5e077461f6ba | ff5717c6-301d-48a3-9833-9b1722557903 | 07ccc7c9772349a582e20f1e0ad5b054 | available | test1snap2   |# J2 A9 \0 r) X4 ^( V( z
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
+ N1 s- i$ q- F  w* f" P, b
8 _; e: F3 D* m5 p5 x4 x5 M/ i0 Y: z3 c% ~! W2 [+ ]! h, ]2 z0 X
mysql -ucinder -p cinder  -h192.168.6.233  h5 U& e2 i* C3 p( D
Enter password:
& e& m7 V0 n% d: I& h" g6 }7 [Reading table information for completion of table and column names, L  r3 z! x* Y( X( P% Z' y3 H' \( B
You can turn off this feature to get a quicker startup with -A, V& U6 @# X. M# U

- T2 y6 O' V7 ~( L4 b" r$ p4 zWelcome to the MariaDB monitor.  Commands end with ; or \g.
( a9 r2 x) d2 G0 Z# x; N4 LYour MariaDB connection id is 157266
( e6 }! P) U5 |* N7 q. T, F7 c! P& B3 bServer version: 10.1.20-MariaDB MariaDB Server- j% X6 q+ y0 \0 M& d. K" Q5 Z

: k' u  U- Q6 o2 j. ~, d& M8 m' ECopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.( s- g2 i# w( k0 B
9 x) J- u$ g  ~0 _  i+ }( b% o
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.# A. I! A1 E/ V- Q/ t
4 k( O, m) t6 p0 l$ w
MariaDB [cinder]>
0 n5 {' j* @2 O  o9 gMariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
- H8 L& P4 S7 N# _9 f) E& C+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
! W6 J: _0 f# f% C| id                                   | volume_id                            | user_id                          | status    | display_name |
% K# U$ |% p/ k+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
% {" b* Z! E0 r- j| 6fdd4a5d-fb65-46bf-80c1-2716c5b4834a | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | 07ccc7c9772349a582e20f1e0ad5b054 | available | test2snap12  |
) U* r" v) B# w5 L9 R: k+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+0 T% y  i; Z" Q9 c0 p7 L/ f" @
1 row in set (0.00 sec)
" |3 ~- D+ p) u" s' R
8 V  K3 O& X1 T0 A. w% X. @! G7 eMariaDB [cinder]> select * from volume_glance_metadata where volume_id = '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';
4 k) B( G' h" T& o+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
3 ?3 n/ Z4 H3 P, N- G% ?, M+ k) R| created_at          | updated_at | deleted_at | deleted | id | volume_id                            | snapshot_id | key              | value                                |
, n% F! A/ o" l6 ]5 Z+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
( T' I/ L- l: U' a9 l| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 51 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | container_format | bare                                 |5 X( I9 K# P* {
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 54 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_ram          | 0                                    |
) P3 P$ J/ n9 M: z" S| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 57 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | disk_format      | raw                                  |
- X' j$ E; P3 u5 \| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 60 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_name       | cirros-0.4                           |
$ U* t1 w/ h6 B/ Q: P) ^. j  E| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 63 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_id         | 5062aa42-bb5e-4793-964f-b6dcc61d5fc6 |
; A: J6 L+ \  t" N: b| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 66 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | checksum         | 443b7623e27ecf03dc9e01ee93f67afe     |
; H/ A5 c$ s! n% h4 b* [| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 69 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_disk         | 0                                    |
0 m0 v2 Q1 [3 b| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 72 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | size             | 12716032                             |
  |" d6 Q( \; h+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
3 a: ?) Y; _7 A& a  b) E
8 i, s: q9 ~. j( a8 rows in set (0.00 sec)
$ Q3 _$ o  u7 @) D$ x! b/ o$ U6 n& E$ B7 M4 S
6 P) {. D+ j) @7 \+ b2 A" M  {
MariaDB [cinder]> delete from volume_glance_metadata where id='51';
6 `9 i; t- k3 ^* q# EQuery OK, 1 row affected (0.00 sec)
% @! j% u8 H3 K4 O  l& t
4 R* c$ ^0 C% b5 ^; Q$ UMariaDB [cinder]> delete from volume_glance_metadata where id='54';9 j# Q6 Q% W1 D' j
Query OK, 1 row affected (0.00 sec)5 F" ?' Z& \! ?# y+ n. w8 H4 l
; H0 ?  R/ A8 |+ f1 h
MariaDB [cinder]> delete from volume_glance_metadata where id='57';0 g$ e  ?( }2 n6 P6 r, _
Query OK, 1 row affected (0.00 sec)
' w* D* g) }  q. B2 X
- Y, q, l& ]4 f: J% x9 C3 J7 c! {MariaDB [cinder]> delete from volume_glance_metadata where id='60';  J& g/ f4 q0 C8 n
Query OK, 1 row affected (0.00 sec)8 [% y- S! ^& Z4 @  L  S! V

9 h+ L5 w+ v0 W  B/ Y0 I+ b6 yMariaDB [cinder]> delete from volume_glance_metadata where id='63';
) e, H5 I& ^5 {. C& g+ u7 DQuery OK, 1 row affected (0.00 sec)! e6 a! C# R" `! M) B, u
  L: l( P9 a6 h% ~$ J9 g
MariaDB [cinder]> delete from volume_glance_metadata where id='66';. C4 i% _) C/ `0 U) a5 U+ Y
Query OK, 1 row affected (0.00 sec)
$ Z# f# U& K( G  j
- X& T& ^$ e1 S& x6 }+ k/ PMariaDB [cinder]> delete from volume_glance_metadata where id='69';
8 y* ?3 E  {" m8 V8 e, O' ~+ sQuery OK, 1 row affected (0.01 sec)
0 ]( }7 ?  T0 [0 d+ [& H3 i* x. c! W1 P, a; z; r' t( E
MariaDB [cinder]> delete from volume_glance_metadata where id='72';
4 N! ]& `8 X$ \Query OK, 1 row affected (0.01 sec). m1 `1 D" n( [- b; F: b+ [
- A' Q9 j9 ]7 S6 K1 q6 }6 t4 ~2 k
+ p) X0 C9 F& Y: L2 r" d* x" Z$ ^
MariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';' ^4 f/ y; g- n# C/ X. \2 _
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`)). }5 f; ?. y. m
MariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';' R, [2 R$ p6 }
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))
6 ~4 U! Z3 `) G' H' uMariaDB [cinder]> delete from snapshots where volume_id= '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';' W/ ]+ [. r9 U. n6 n) J% {: K
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`cinder`.`volume_glance_metadata`, CONSTRAINT `volume_glance_metadata_ibfk_2` FOREIGN KEY (`snapshot_id`) REFERENCES `snapshots` (`id`))5 U3 ?! N0 n6 w% n* M1 W
MariaDB [cinder]> 3 t; a1 ]; T# b

- E: F- v2 h: S# G9 @- V( Y) {" I9 e! G7 s5 r

( y# I2 }! C7 k6 _8 }
; `5 w( |( K) ]! I3 K3 |( Z3 Z
 楼主| 发表于 2021-5-19 17:25:49 | 显示全部楼层
未找到原因,通过界面可以删除。建议不要随便删除数据库数据,否则会导致数据库缺少数据字段。
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

如有购买积分卡请联系497906712

QQ|返回首页|Archiver|手机版|小黑屋|易陆发现 点击这里给我发消息

GMT+8, 2021-6-20 20:09 , Processed in 0.050145 second(s), 22 queries .

Powered by 龙睿 bbs168x X3.2

© 2001-2020 Comsenz Inc.

快速回复 返回顶部 返回列表