找回密码
 注册
查看: 2383|回复: 1

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2021-5-19 15:49:39 | 显示全部楼层 |阅读模式
MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '71146765-659d-47c9-9682-5e077461f6ba';/ G' M& R3 g% l) B/ O
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
# _& A$ B, v3 l| id                                   | volume_id                            | user_id                          | status    | display_name |
& n7 h7 D8 [0 v) H: ~+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+2 ?. ?8 M7 \' q, q! }: n( g* O4 x
| 71146765-659d-47c9-9682-5e077461f6ba | ff5717c6-301d-48a3-9833-9b1722557903 | 07ccc7c9772349a582e20f1e0ad5b054 | available | test1snap2   |- a) ?' L/ o) L9 ~* i% }4 s
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+
6 ]4 E6 H7 W  A8 N. L
# f% I0 [/ a! b1 ?
# N+ u# F, c: Q0 v" h, ]9 G& Qmysql -ucinder -p cinder  -h192.168.6.233( x( T+ ?7 H  K1 ?" S
Enter password:
, y2 d6 I; c# P% r. L) t$ bReading table information for completion of table and column names$ g2 k: w. q. b  z+ J. p3 S
You can turn off this feature to get a quicker startup with -A
- u( j' [4 O1 w* @: {, ~* [; Q8 }& f
1 B  ^9 f7 H- \+ h: R, SWelcome to the MariaDB monitor.  Commands end with ; or \g.% h2 i0 h# d9 p0 J) I. I5 h
Your MariaDB connection id is 157266% ]" A! Q. K% L4 |3 J
Server version: 10.1.20-MariaDB MariaDB Server1 W" t4 q2 }, U4 Y" c

7 o& {4 W: F: R% N2 o# N+ nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others., {8 F0 {# |- Y/ K; K& E: a
  j% D* {7 N* y4 H$ l
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
5 H, j' _9 ?7 I1 U4 T9 m& r( r* N
MariaDB [cinder]> 1 B1 v8 ^  n# k( N( W( c
MariaDB [cinder]> select id,volume_id,user_id,status,display_name from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
  {0 v& M) q7 e+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+% @9 Q' T9 l7 @  ^3 E9 A3 U
| id                                   | volume_id                            | user_id                          | status    | display_name |
) A5 Q, I5 x7 W9 Q5 ~1 e2 ]+ d+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------++ |! x  E1 D, s0 _
| 6fdd4a5d-fb65-46bf-80c1-2716c5b4834a | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | 07ccc7c9772349a582e20f1e0ad5b054 | available | test2snap12  |0 d8 m# I$ Z' y  E: ]/ ^( _
+--------------------------------------+--------------------------------------+----------------------------------+-----------+--------------+! o  J! R; {- e) d7 l! p
1 row in set (0.00 sec)/ I# H6 r! Y6 X* W
7 g7 A" a2 e' p/ t; b5 g
MariaDB [cinder]> select * from volume_glance_metadata where volume_id = '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';
5 o% G6 p9 N( ?. }& Z+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
( r& t1 k$ {# }7 Y! q% A| created_at          | updated_at | deleted_at | deleted | id | volume_id                            | snapshot_id | key              | value                                |9 U8 Q$ w+ M1 B+ J& ?) R8 S
+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
& O, }7 u$ |, K5 {& B3 a| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 51 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | container_format | bare                                 |) e6 h5 p# m& T( {
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 54 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_ram          | 0                                    |- O& {  U$ ], H& O
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 57 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | disk_format      | raw                                  |
# |" v) s( l- v  \| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 60 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_name       | cirros-0.4                           |( ~2 W- j8 L$ i/ O' ^2 D
| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 63 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | image_id         | 5062aa42-bb5e-4793-964f-b6dcc61d5fc6 |
+ V/ _1 O8 l; X# l+ _| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 66 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | checksum         | 443b7623e27ecf03dc9e01ee93f67afe     |
& H+ y9 v  H( E# Y* @| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 69 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | min_disk         | 0                                    |
/ I- l7 r) a. k" b$ [! o| 2021-05-18 07:08:10 | NULL       | NULL       |       0 | 72 | 8ac8ded1-2ade-46de-8c2f-75ec9bf194af | NULL        | size             | 12716032                             |* `& \  K$ k* \! |. s2 V( }
+---------------------+------------+------------+---------+----+--------------------------------------+-------------+------------------+--------------------------------------+
+ c; l' @$ L$ F% Q, h
+ [  P. M# k! o+ \8 rows in set (0.00 sec)- Y' D' |8 T8 S+ E& O1 H

! ]) l  \7 e) B+ [/ y2 d4 W, A6 s
, ?  `. x; I( ^MariaDB [cinder]> delete from volume_glance_metadata where id='51';
) _) y1 o7 k. ~9 B# j: j$ f5 H5 YQuery OK, 1 row affected (0.00 sec)8 q. w0 H7 R3 n

: Y* U7 G8 R+ B# \) BMariaDB [cinder]> delete from volume_glance_metadata where id='54';1 R* [! A' a7 V
Query OK, 1 row affected (0.00 sec)  ^( u2 U7 z$ E( y) |; w9 C( P
( o/ R' f. h& n' e
MariaDB [cinder]> delete from volume_glance_metadata where id='57';6 |) V# u) G- ~5 Z
Query OK, 1 row affected (0.00 sec)
: F3 w+ j- c9 g6 ?9 v6 |
9 ]. c& d- r- A4 c: ^MariaDB [cinder]> delete from volume_glance_metadata where id='60';
6 C/ K6 R6 P" A2 h  m- a: o  KQuery OK, 1 row affected (0.00 sec). Q4 E5 L" \; r, Q1 v1 ]1 u
9 w; B  r# L2 o6 Z) l0 J5 E" y% B8 c
MariaDB [cinder]> delete from volume_glance_metadata where id='63';" C+ r2 y% G  ]5 P# l
Query OK, 1 row affected (0.00 sec)
/ H, W( G# \/ l& p
2 D+ H7 v6 c6 D# ]MariaDB [cinder]> delete from volume_glance_metadata where id='66';
9 P! Q/ P7 a; t, fQuery OK, 1 row affected (0.00 sec)
* @' k9 u4 l8 U8 I1 A+ Q- m8 q" U6 }
0 ?% N3 C4 q6 ~* _, q& d& P( V% xMariaDB [cinder]> delete from volume_glance_metadata where id='69';
3 n" n% [$ i1 Q( p; c9 w- IQuery OK, 1 row affected (0.01 sec)
; O8 w; ^, j& M" c, W) [8 Q5 i% ~# S, x5 n/ K3 }
MariaDB [cinder]> delete from volume_glance_metadata where id='72';
& H+ J- ]8 c, Q; }; p7 ~Query OK, 1 row affected (0.01 sec)/ u+ B9 @) p/ J# z
3 [" u- G1 W9 u, k+ T& G
* [: |/ T, A- Z  h8 A! ]3 @
MariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
" w& n" f2 p, T7 j; l5 [) [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`))& }- b. R7 f% A# x/ x1 a% E
MariaDB [cinder]> delete from snapshots where id= '6fdd4a5d-fb65-46bf-80c1-2716c5b4834a';
" ~& p9 _! p, u0 s2 |1 {/ kERROR 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`))3 Y0 _2 A5 W3 n* e
MariaDB [cinder]> delete from snapshots where volume_id= '8ac8ded1-2ade-46de-8c2f-75ec9bf194af';
4 D. z6 L& y' NERROR 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`))/ h2 r0 T3 q! N; T. z: a) {! w( z
MariaDB [cinder]>
+ b) }# V+ r+ L: l" E) g) Y8 i1 {- T8 q8 F! \
/ x' F3 n! p  E; [% S! }+ J! i

. L! x' Y/ @4 B3 {# h: ^+ Z* i) G$ |$ Q& Q

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2021-5-19 17:25:49 | 显示全部楼层
未找到原因,通过界面可以删除。建议不要随便删除数据库数据,否则会导致数据库缺少数据字段。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 02:23 , Processed in 0.018857 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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